<html>
  
  <body>
    <div class="dropdown select_para_box">
    <button id="select_para" type="button" data-toggle="dropdown" class="btn btn-info" aria-haspopup="true" aria-expanded="false">
        插入参数
        <span class="caret"></span>
    </button>
    <ul class="dropdown-menu" aria-labelledby="dLabel">
        <li>{1}</li>
        <li>{2}</li>
        <li>{3}</li>
        <li>{4}</li>
    </ul>
</div>
<!--输入框-->
<textarea name="msg_content" id="msg_content" class="form-control"></textarea>
  </body>
</html>
$(function(){
  // 下拉菜单中点击文字事件
  $('.select_para_box').on('click','li',function(){
      // 设置textarea聚焦
      document.getElementById('msg_content').focus();
      // 先获取#msg_content内容,加上选中的文字,再重新赋值给#msg_content
      $('#msg_content').val($('#msg_content').val()+$(this).text());
  });
  
});

External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js