Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <div class="form">
  2. <h4>
  3. List 1
  4. </h4>
  5. <ul id="list">
  6. <li>Item 1 <input></li>
  7. </ul>
  8. <button id="addItem">
  9. Add Item
  10. </button>
  11.  
  12. </div>
  13.  
  14. <button id="addList">
  15. Add List
  16. </button>
  17. </body>
  18.  
  19. //add List Item
  20. itemNumber = 2;
  21.  
  22. $("#addItem").click(function(){
  23.  
  24. newItem = "<li>Item "+ itemNumber +" <input></li>";
  25.  
  26. $('#list').append(newItem);
  27.  
  28. itemNumber = itemNumber + 1;
  29. })
  30.  
  31.  
  32.  
  33. //add another list
  34. listNumber = 2;
  35.  
  36. $("#addList").click(function(){
  37.  
  38. newList = "<h4>List 1</h4> <ul id='list'> <li>Item 1</li> </ul> <button id='addItem'>Add Item</button>";
  39.  
  40. $('.form').append(newList);
  41.  
  42. listNumber = listNumber + 1;
  43. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement