标签:max color cli country put try append hold name
function addLi(){ var listNum=$(".divList").length; var num= listNum == 0 ? 1: listNum+1 ; console.log(num); var divObj = ‘<div class="divList"><input class="small_input" placeholder="起始年份" name="start_year‘+num +‘" /><input class="small_input" placeholder="结束年份" name="end_year‘+num +‘" /><input class="small_input" placeholder="国家" name="country‘+num +‘" /><input class="small_input" placeholder="项目金额" name="item_amount‘+num +‘" /><input class="small_input" placeholder="项目名称" name="item_name‘+num +‘" /></div>‘ $(‘.main_business‘).append(divObj); var input_sum_val=$(".input_sum").val() $(".input_sum").val(++input_sum_val); }
<dd style="height: auto;"> <label>主营业务</label> <input class="input_sum" type="hidden" name="max" value="1" /> <div class="main_business"> <input class="small_input" placeholder="起始年份"><input class="small_input" placeholder="结束年份"> <input class="small_input" placeholder="国家"><input class="small_input" placeholder="项目金额"><input class="small_input" placeholder="项目名称"> </div> <button onclick="addLi()">add</button> </dd>
标签:max color cli country put try append hold name
原文地址:https://www.cnblogs.com/zhangjianzhen/p/9049214.html