<script type= "Text/javascript" >
var blocknum=10;
$ (document). Ready (function () {
var parentdom=$ (' #father '). Find ("form"), Oridom=parentdom.children (": First");
$ ('. Btnadd '). Click (function () {
var cllength=parentdom.children (). length;
if (blocknum>cllength) {
var nowdom=oridom.clone ();
Nowdom.children (": First"). Text (' config ');
Parentdom.append (Nowdom);
}
else return false;
});
$ ('. Btnsub '). Click (function () {
$ ('. Conform '). Submit ();
});
});
</script>
<input type= ' button ' class= ' Btnadd ' value= ' Add '/>
<div id= "Father" >
<form action= "<%=request.getcontextpath ()%>/testservlet" method= "POST" name= "conform" class= "conform" >
<fieldset>
<legend> Configuration </legend>
<input type= "text" value= "" Name= "TestName" class= "testname"/>
<input type= ' button ' class= ' Btndel ' value= ' delete ' onclick = ' $ (this). Parent (). remove (); />
</fieldset>
</form>
</div>
<input type= "button" class= "Btnsub" value= "Commit"/>
jquery Implementation Click a button to add multiple div