Guest User

Untitled

a guest
Jan 18th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. function content(){
  2. alert("test");
  3. $(".two button").click(function(){
  4. var id = $(this).parent().attr("id");
  5. alert(id);
  6. });
  7. }
  8.  
  9. $(document).on("click", ".two button", function(){
  10. // put a click hander on the document to process clicks
  11. // from buttons that are descendants of elements with class=two
  12.  
  13. $('body').on('click', '.two button', function(){
  14. var id = $(this).parent().attr("id");
  15. alert(id);
  16. });
  17.  
  18. $('#my-div').on('click', '.two button', function(){
  19. var id = $(this).parent().attr("id");
  20. alert(id);
  21. });
  22.  
  23. $(".two button").on("click",function(){
  24. var id = $(this).parent().attr("id");
  25. alert(id);
  26. });
  27.  
  28. function content(element){
  29. $(element).click(function(){
  30. var id = $(this).parent().attr("id");
  31. alert(id);
  32. });
  33. }
Add Comment
Please, Sign In to add comment