SHARE
TWEET

validations-js

a guest Sep 13th, 2017 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.     var max_fields      = 10; //maximum input boxes allowed
  3.     var wrapper         = $(".input-fields-wrap1"); //Fields wrapper
  4.     var add_button      = $(".add-field-button1"); //Add button ID
  5.    
  6.     var x = 1; //initlal text box count
  7.     $(add_button).click(function(e){ //on add input button click
  8.         e.preventDefault();
  9.         if(x < max_fields){ //max input box allowed
  10.             x++; //text box increment
  11.             $(wrapper).append('<div class="append-button col-2"><select class="validations-dropdown"><option value="lessthan"> Less Than </option><option value="Equalto">Equal To </option><option value="Greaterthan">Greater Than</option></div>');
  12.             $(wrapper).append('<div><input class="data-field col-2" type="text" name="mytext[]"/><a href="#" class="remove-field">Remove</a></div>'); //add input box
  13.         }
  14.     });
  15.    
  16.     $(wrapper).on("click",".remove-field", function(e){ //user click on remove text
  17.         e.preventDefault(); $(this).parent('div').remove(); x--;
  18.     })
  19. });
  20.  
  21. $(document).ready(function() {
  22.     var max_fields      = 10; //maximum input boxes allowed
  23.     var wrapper         = $(".input-fields-wrap2"); //Fields wrapper
  24.     var add_button      = $(".add-field-button2"); //Add button ID
  25.    
  26.     var x = 1; //initlal text box count
  27.     $(add_button).click(function(e){ //on add input button click
  28.         e.preventDefault();
  29.         if(x < max_fields){ //max input box allowed
  30.             x++; //text box increment
  31.             $(wrapper).append('<div class="append-button col-2"><select class="validations-dropdown"><option value="lessthan"> Less Than </option><option value="Equalto">Equal To </option><option value="Greaterthan">Greater Than</option></div>');
  32.             $(wrapper).append('<div><input class="data-field col-2" type="text" name="mytext[]"/><a href="#" class="remove-field">Remove</a></div>'); //add input box
  33.         }
  34.     });
  35.    
  36.     $(wrapper).on("click",".remove-field", function(e){ //user click on remove text
  37.         e.preventDefault(); $(this).parent('div').remove(); x--;
  38.     })
  39. });
  40.  
  41. $(document).ready(function() {
  42.     var max_fields      = 10; //maximum input boxes allowed
  43.     var wrapper         = $(".input-fields-wrap3"); //Fields wrapper
  44.     var add_button      = $(".add-field-button3"); //Add button ID
  45.    
  46.     var x = 1; //initlal text box count
  47.     $(add_button).click(function(e){ //on add input button click
  48.         e.preventDefault();
  49.         if(x < max_fields){ //max input box allowed
  50.             x++; //text box increment
  51.             $(wrapper).append('<div class="append-button col-2"><select class="validations-dropdown"><option value="lessthan"> Less Than </option><option value="Equalto">Equal To </option><option value="Greaterthan">Greater Than</option></div>');
  52.             $(wrapper).append('<div><input class="data-field col-2" type="text" name="mytext[]"/><a href="#" class="remove-field">Remove</a></div>'); //add input box
  53.         }
  54.     });
  55.    
  56.     $(wrapper).on("click",".remove-field", function(e){ //user click on remove text
  57.         e.preventDefault(); $(this).parent('div').remove(); x--;
  58.     })
  59. });
  60.  
  61.  
  62. $(document).ready(function() {
  63.     var max_fields      = 10; //maximum input boxes allowed
  64.     var wrapper         = $(".input-fields-wrap4"); //Fields wrapper
  65.     var add_button      = $(".add-field-button4"); //Add button ID
  66.    
  67.     var x = 1; //initlal text box count
  68.     $(add_button).click(function(e){ //on add input button click
  69.         e.preventDefault();
  70.         if(x < max_fields){ //max input box allowed
  71.             x++; //text box increment
  72.             $(wrapper).append('<div class="append-button col-2"><select class="validations-dropdown"><option value="lessthan"> Less Than </option><option value="Equalto">Equal To </option><option value="Greaterthan">Greater Than</option></div>');
  73.             $(wrapper).append('<div><input class="data-field col-2" type="text" name="mytext[]"/><a href="#" class="remove-field">Remove</a></div>'); //add input box
  74.         }
  75.     });
  76.    
  77.     $(wrapper).on("click",".remove-field", function(e){ //user click on remove text
  78.         e.preventDefault(); $(this).parent('div').remove(); x--;
  79.     })
  80. });
  81.  
  82. $(document).ready(function() {
  83.     var max_fields      = 10; //maximum input boxes allowed
  84.     var wrapper         = $(".input-fields-wrap5"); //Fields wrapper
  85.     var add_button      = $(".add-field-button5"); //Add button ID
  86.    
  87.     var x = 1; //initlal text box count
  88.     $(add_button).click(function(e){ //on add input button click
  89.         e.preventDefault();
  90.         if(x < max_fields){ //max input box allowed
  91.             x++; //text box increment
  92.             $(wrapper).append('<div class="append-button col-2"><select class="validations-dropdown"><option value="lessthan"> Less Than </option><option value="Equalto">Equal To </option><option value="Greaterthan">Greater Than</option></div>');
  93.             $(wrapper).append('<div><input class="data-field col-2" type="text" name="mytext[]"/><a href="#" class="remove-field">Remove</a></div>'); //add input box
  94.         }
  95.     });
  96.    
  97.     $(wrapper).on("click",".remove-field", function(e){ //user click on remove text
  98.         e.preventDefault(); $(this).parent('div').remove(); x--;
  99.     })
  100. });
  101.  
  102. $(document).ready(function() {
  103.     var max_fields      = 10; //maximum input boxes allowed
  104.     var wrapper         = $(".input-fields-wrap6"); //Fields wrapper
  105.     var add_button      = $(".add-field-button6"); //Add button ID
  106.    
  107.     var x = 1; //initlal text box count
  108.     $(add_button).click(function(e){ //on add input button click
  109.         e.preventDefault();
  110.         if(x < max_fields){ //max input box allowed
  111.             x++; //text box increment
  112.             $(wrapper).append('<div class="append-button col-2"><select class="validations-dropdown"><option value="lessthan"> Less Than </option><option value="Equalto">Equal To </option><option value="Greaterthan">Greater Than</option></div>');
  113.             $(wrapper).append('<div><input class="data-field col-2" type="text" name="mytext[]"/><a href="#" class="remove-field">Remove</a></div>'); //add input box
  114.         }
  115.     });
  116.    
  117.     $(wrapper).on("click",".remove-field", function(e){ //user click on remove text
  118.         e.preventDefault(); $(this).parent('div').remove(); x--;
  119.     })
  120. });
  121.  
  122. $(document).ready(function() {
  123.     var max_fields      = 10; //maximum input boxes allowed
  124.     var wrapper         = $(".input-fields-wrap7"); //Fields wrapper
  125.     var add_button      = $(".add-field-button7"); //Add button ID
  126.    
  127.     var x = 1; //initlal text box count
  128.     $(add_button).click(function(e){ //on add input button click
  129.         e.preventDefault();
  130.         if(x < max_fields){ //max input box allowed
  131.             x++; //text box increment
  132.             $(wrapper).append('<div class="append-button col-2"><select class="validations-dropdown"><option value="lessthan"> Less Than </option><option value="Equalto">Equal To </option><option value="Greaterthan">Greater Than</option></div>');
  133.             $(wrapper).append('<div><input class="data-field col-2" type="text" name="mytext[]"/><a href="#" class="remove-field">Remove</a></div>');//add input box
  134.         }
  135.     });
  136.    
  137.     $(wrapper).on("click",".remove-field", function(e){ //user click on remove text
  138.         e.preventDefault(); $(this).parent('div').remove(); x--;
  139.     })
  140. });
  141.  
  142. $(document).ready(function() {
  143.     var max_fields      = 10; //maximum input boxes allowed
  144.     var wrapper         = $(".input-fields-wrap8"); //Fields wrapper
  145.     var add_button      = $(".add-field-button8"); //Add button ID
  146.    
  147.     var x = 1; //initlal text box count
  148.     $(add_button).click(function(e){ //on add input button click
  149.         e.preventDefault();
  150.         if(x < max_fields){ //max input box allowed
  151.             x++; //text box increment
  152.             $(wrapper).append('<div class="append-button col-2"><select class="validations-dropdown"><option value="lessthan"> Less Than </option><option value="Equalto">Equal To </option><option value="Greaterthan">Greater Than</option></div>');
  153.             $(wrapper).append('<div><input class="data-field col-2" type="text" name="mytext[]"/><a href="#" class="remove-field">Remove</a></div>'); //add input box
  154.         }
  155.     });
  156.    
  157.     $(wrapper).on("click",".remove-field", function(e){ //user click on remove text
  158.         e.preventDefault(); $(this).parent('div').remove(); x--;
  159.     })
  160. });
RAW Paste Data
Top