Posted By

elarson on 10/06/08


Tagged

javascript jquery


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

shaho
kikuchiyosesa


Watch events fired using jQuery


 / Published in: JavaScript
 

This just uses jQuery to see what events get fired on a object.

  1. function watch_events(e) {
  2. var events = [
  3. 'blur',
  4. 'focus',
  5. 'load',
  6. 'resize',
  7. 'scroll',
  8. 'unload',
  9. 'click',
  10. 'dblclick',
  11. // 'mousedown',
  12. // 'mouseup',
  13. // 'mousemove',
  14. // 'mouseover',
  15. // 'mouseout',
  16. // 'mouseenter',
  17. // 'mouseleave',
  18. 'change',
  19. 'select',
  20. 'submit',
  21. 'keydown',
  22. 'keypress',
  23. 'keyup',
  24. 'error'
  25. ];
  26.  
  27. $.each(events, function (i, val) {
  28. // console.log('Binding: ' + val);
  29. $(e).bind(val, function (evt) {
  30. var msg = evt.type + ' on ' + evt.target.id + ' ' + evt.target.localName;
  31. console.log(msg);
  32. } );
  33. });
  34. }

Report this snippet  

You need to login to post a comment.