jquery获取同一个属性的多个input值

<input type="text" name="name"  >
<input type="text" name="name"  >
$("input[name='name']").each(function(index,item) {
   console.log(this.value)
   })

 

 

jquery获取同一个属性的多个select值
数据如:

 

{{ project_data.choiceSelect }}
# [{'verbose_name': 'age', 'options': ['11', '22', '33']}, {'verbose_name': 'name', 'options': ['zhangsan', 'li']}]
{% for choice in project_data.choiceSelect %}
    <div class="form-group">
        <label><input id="choice_name" value="{{ choice.verbose_name }}" disabled style="border: none" name="choice_name"></label>
          <select class="choice_options form-control"  id="choice_options">
                   {% for ds in choice.options %}
                       <option value="{{ds}}" name="choice_options">{{ds}}</option>
                   {% endfor %}
           </select>
   </div>
{% endfor %}

jquery--获取同一个属性的多个input,和select

 

 

var choice_options_list = new Array()
$(".choice_options").each(function(index,item) {
   choice_options_list.push(this.value)
})
   console.log(choice_options_list)

jquery--获取同一个属性的多个input,和select

 

 

 

jquery点击增加同样的表单内容

<div class="form-group">
  <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">日志路径 <span class="required" style="color: red">*</span>
  </label>
  <div class=" logs col-md-6 col-sm-6 col-xs-12" >
    <input type="text" >
  </div>
</div>
  <input type="button" value="添加" onclick="add()">

// 添加日志输入框函数
    var addLog = '<input type="text" >'

    function add() {
        $(".logs").append(addLog)

    }

 

 

相关文章:

  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2021-10-30
  • 2021-12-28
  • 2021-11-24
相关资源
相似解决方案