Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <div id="test" style="display: block; opacity: 0.89;"></div>
  2.  
  3. $("#test").click(function(){ return false});
  4. $("#test").unbind();
  5. $("#test").removeAttr("onclick");
  6. //Suggestions which do not work
  7. $('#test').on('click', function(e) {e.preventDefault();return false;});
  8. $("#test").click(function(event){
  9. event.preventDefault();
  10. });
  11.  
  12. $(function () {
  13. $("#test").click(function(){alert('test');});
  14. $("#test").off('click');
  15.  
  16. });
  17.  
  18. $("#test").click(function(){ return false});
  19. $("#test").unbind();
  20. $("#test").removeAttr("onclick");
  21.  
  22. var $test = $("#test").removeAttr("onclick"),
  23. $contents = $test.contents().detach();
  24. $test.replaceWith($test.clone(false).append($contents));
  25.  
  26. // To disable:
  27.  
  28. $('#test').each(function (){
  29. this.style.pointerEvents = 'none';
  30. });
  31.  
  32. // To re-enable:
  33. $('#test').each(function (){
  34. this.style.pointerEvents = 'auto';
  35. });
  36.  
  37. $('#test').on('click', function(e) {e.preventDefault();return false;});
  38.  
  39. $("#test").click(function(event) {
  40. event.preventDefault();
  41. });
  42.  
  43. $('#test').unbind('click')
  44.  
  45. $( "#test" ).bind( "click", handler );
  46. $( "#test" ).unbind( "click", handler );
  47.  
  48. $( "#test" ).on("click", function () {
  49. });
  50. $("#test").off("click");
  51.  
  52. $("#test").click(function(){
  53. $( "#test" ).unbind( "click");
  54. alert('Jquery/Javascript Event');
  55. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement