Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.44 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Can I add an event to an object before it is created?
  2. <a class="editLink" href="/location/Edit?city=05">Edit</a>
  3.        
  4. $(".editLink").button();
  5. $(".editLink").click(function () {
  6.     alert('edit link');
  7.     return false;
  8. });
  9.        
  10. $(".editLink").button();
  11.        
  12. $(document).on('click', '.editLink', function() {
  13.   alert('edit link');
  14.   return false;
  15. });
  16.        
  17. $('body').on('click', '.editLink', function() {
  18.   alert('edit link');
  19.   return false;
  20. });