Handle javascript events

When handling javascript events, keep in mind:

  • Do not call the event directly on the object, but must call it through the on function.

$(‘element’).on(‘event’,fucntion(){

//Code here;

});

  • When handling event on object returned from ajax, to ensure working on safari use below code.

$(‘document’).on(‘event’, ‘element’, function(){

//Code here.

});

event: event to do for element.

element: event summoning element

Bài viết liên quan