87,910
社区成员
发帖
与我相关
我的任务
分享
$("#addTable").click(function () {
var tr = "<tr>";
tr += "<td><input id=\"Name_0"+a+"\" type=\"text\"></td>";
tr += "<td> <select id=\"Gender_0" + a + "\"><option value=\"男\">男</option><option value=\"女\" >女</option></td>";
tr += "<td><input id=\"Birthday_0" + a + "\" type=\"text\" class=\"Wdate\" onclick=\"WdatePicker({ dateFmt: 'yyyy/MM/dd' })\" style=\"cursor: pointer;\"></td>";
tr += "<td><input id=\"HuKouXingZhi__0" + a + "\" type=\"text\"></td>";
tr += "<td><input id=\"ZiNvShuXing_0" + a + "\" type=\"text\"></td>";
tr += "<td><input id=\"ZhengCe_0" + a + "\" type=\"text\"></td>";
tr += "<td><input id=\"ZhengCeLeiXing_0" + a + "\" type=\"text\"></td>";
tr += "</tr>";
$("#addChidren").append(tr);
});
<button type="button" value="增加" id="addTable">子女情况+</button>
<table id="addChidren" class="addChidren" border="0" cellpadding="0" cellspacing="1">
<tr id="trTop">
<th>姓名</th>
<th>性别</th>
<th>出生年月</th>
<th>户籍性质</th>
<th>子女属性</th>
<th>符合何种政策</th>
<th>符合政策类型</th>
</tr>
</table>
var a = 0;
$("#addTable").click(function () {
a++;
var tr = "<tr>";
tr += "<td><input id=\"Name_0"+a+"\" type=\"text\"></td>";
tr += "<td> <select id=\"Gender_0" + a + "\"><option value=\"男\">男</option><option value=\"女\" >女</option></td>";
tr += "<td><input id=\"Birthday_0" + a + "\" type=\"text\" class=\"Wdate\" onclick=\"WdatePicker({ dateFmt: 'yyyy/MM/dd' })\" style=\"cursor: pointer;\"></td>";
tr += "<td><input id=\"HuKouXingZhi__0" + a + "\" type=\"text\"></td>";
tr += "<td><input id=\"ZiNvShuXing_0" + a + "\" type=\"text\"></td>";
tr += "<td><input id=\"ZhengCe_0" + a + "\" type=\"text\"></td>";
tr += "<td><input id=\"ZhengCeLeiXing_0" + a + "\" type=\"text\"></td>";
tr += "</tr>";
$("#addChidren").append(tr);
});
你自己不是写了个变量a么,,每次加1不就完了。