'); newTextBoxDiv.appendTo(".fGroup"); counter++; } function remove_fields() { var counter = 3; if(counter-1==1){ alert("you need one textbox required."); return false; } counter--; jQuery(".TextBoxDiv" + counter).remove(); }