MemoryRefresh!

Form / Form add element     Form add element



Questions Answers 0%

Pages   0 from 16
Questions   0 from 21

Reset



<script type="text/javascript" src="code.jquery.com"></script> <a href="#" onClick="addFormField(); return false;">Add</a> <form action="#" method="get" id="form1"> <input type="hidden" id="fieldOrder" value="1"> <div id="divTxt"></div> </form> <script> function addFormField() { var id = document.getElementById("fieldOrder").value; $("#divTxt").append("<p id='row" + id + "'><label for='txt" + id + "'>Field " + id + " <input type='file' size='20' name='images[]' id='images" + id + "'> <a href='#' onClick='removeFormField("#row" + id + ""); return false;'>Remove</a><p>"); id = (id-1) + 2; document.getElementById("fieldOrder").value = id; } function removeFormField(id) { $(id).remove(); } </script>


<script type="text/javascript" src="code.jquery.com"></script> <a href="#" onClick="addFormField(); return false;">Add</a> <form action="#" method="get" id="form1"> <input type="hidden" id="fieldOrder" value="1"> <div id="divTxt"></div> </form> <script> function addFormField() { var id = document.getElementById("fieldOrder").value; $("#divTxt").append("<p id='row" + id + "'><label for='txt" + id + "'>Field " + id + " <input type='file' size='20' name='images[]' id='images" + id + "'> <a href='#' onClick='removeFormField("#row" + id + ""); return false;'>Remove</a><p>"); id = (id-1) + 2; document.getElementById("fieldOrder").value = id; } function removeFormField(id) { $(id).remove(); } </script>





Programming

Php
   
Regex
   
MySQL
   
Css
   
jQuery
   
Git
   


References
n/a