daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 174 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. counter = 1;
  2. function addFormField() {
  3.  
  4.   email = "E-Mail-Adresse";
  5. $("#divTxt").append("<div id='field" + counter + "'><br><label for='txt" + counter +"'>" + counter +"</label>");
  6. $("#divTxt").append("<input type='text' size = '60' name='txt[]' value=\'email\' onblur='this.value=email' onfocus='this.value=\"\"''  id= 'txt" + counter +"'></div>");
  7. $("#divTxt").append("<div id='change" + counter +"'>");
  8. $("#divTxt").append("<a href='#' onclick='addFormField();return false;'>+</a>");
  9. $("#divTxt").append("<a href='#' onclick='removeFormField();return false;'>-</a></div>");
  10.  
  11. if(counter > 1){
  12. $('#change' + (counter -1)).hide();
  13. }
  14.  
  15.  
  16.   counter++;
  17.  
  18. }
  19.  
  20.  
  21.  
  22.  
  23. function removeFormField() {
  24. $('#field' + (counter)).hide();
  25. $('#change' + (counter)).hide();  
  26.  
  27. $('#change' + (counter -1)).show();
  28.  
  29.  
  30. counter--;
  31.  
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top