动态添加文本框
程序员文章站
2022-06-20 21:02:34
...
function test(){
num+=1;
var htmlCont="";
htmlCont += "<div class='till'> "
+"<div class='form-row'><div class='col-3 text-center'> <p></p></div>"
+" <div class='col-6'>"
+" <div class='form-group form-row'>"
+" <label for='' class='col-3 text-right sr-only'>测试</label>"
+" <input type='text' class='form-control col-7' id='tt' name='tt' placeholder='测试'>"
+" <span class='col-2 small_area'></span>"
+" </div>"
+" </div>"
+" </div>"
+" </div>";
// var obj=document.getElementById("addHtml").innerHTML;
// document.getElementById("addHtml").innerHTML=obj+htmlCont;
$("#addHtml").append(htmlCont);
}
再记录一个用法:
$("#test").find("tbody").find("tr:eq("+i+")").find("td:eq(7)").find("input:eq(0)").prop('checked',true);