Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- counter = 1;
- function addFormField() {
- email = "E-Mail-Adresse";
- $("#divTxt").append("<div id='field" + counter + "'><br><label for='txt" + counter +"'>" + counter +"</label>");
- $("#divTxt").append("<input type='text' size = '60' name='txt[]' value=\'email\' onblur='this.value=email' onfocus='this.value=\"\"'' id= 'txt" + counter +"'></div>");
- $("#divTxt").append("<div id='change" + counter +"'>");
- $("#divTxt").append("<a href='#' onclick='addFormField();return false;'>+</a>");
- $("#divTxt").append("<a href='#' onclick='removeFormField();return false;'>-</a></div>");
- if(counter > 1){
- $('#change' + (counter -1)).hide();
- }
- counter++;
- }
- function removeFormField() {
- $('#field' + (counter)).hide();
- $('#change' + (counter)).hide();
- $('#change' + (counter -1)).show();
- counter--;
- }
Add Comment
Please, Sign In to add comment