ExpertRefresh

Form / Dinamicaly add element  

No questions


<script type="text/javascript" src=""></script> <a href="#" onClick="addFormField();">Add</a> <input type="hidden" id="fieldOrder" value="1"> <div id="divTxt"></div> <script> function addFormField() { var id = $("#fieldOrder").val(); $("#divTxt").append( "<p id='row" + id + "'>" + id + "<input type='text' size='3'>" + "<a href='#' onClick='removeFormField("#row" + id + "");'>Remove</a>" + "<p>" ); id = (id-1) + 2; $("#fieldOrder").val(id); } function removeFormField(id) { $(id).remove(); } </script>


References



n/a