MemoryRefresh!

Form add element



Questions Answers 0%

Pages   0 from 18
Questions   0 from 23

Reset




<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></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>
Questions

Related pages

Form add element !
Input set value !
Two select related !
Get all elements !
Checkbox checked !
Dinamicaly add element !
Set get value !


0% 100%
 
 
0 pages 18 pages
No questions


<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></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>



More from Jquery

Data
Effects
Window
Attributes
Element
Basics
Ajax
Form
Uncategorized


More from Programming

Php
jQuery




Powered by minte9.com