Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <div class="form-group form-inline phone">
  2. <label class="col-sm-2 control-label">Phone</label>
  3. <div class="col-sm-10">
  4. <input type="text" class="form-control" id="phonetype1" placeholder="Type of Phone">
  5. <input type="text" class="form-control" id="number1" placeholder="Write here your phone number">
  6. </div>
  7. </div>
  8. <span id="newPhone"> Add a phone number</span>
  9.  
  10. $("#newPhone").on('click',function(){
  11. var numItems = $('.phone').length +1;
  12. var newPhone= '<div class="form-group form-inline phone">';
  13. newPhone+= '<label class="col-sm-2 control-label"></label>';
  14. newPhone+= '<div class="col-sm-10">';
  15. newPhone+= '<input type="text" class="form-control" id="phonetype'+numItems+'" placeholder="Type of Phone">';
  16. newPhone+= '<input type="text" class="form-control" id="number'+numItems+'"" placeholder="Write here your phone number">';
  17. newPhone+= '</div> </div>';
  18. $(this).before(newPhone);
  19. });
  20.  
  21. $(function()
  22. {
  23. $("input").on('blur',function(){
  24. var formElementId = $(this).attr("id");
  25. validateField(formElementId); //This function works, for sure
  26. });
  27. });
  28.  
  29. $("form").on('blur','input',function(){
  30. var formElementId = $(this).attr("id");
  31. validateField(formElementId); //This function works, for sure
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement