Overview of the problem
In jQuery, the order in which you bind a handler is the order in which they will be executed if you are binding to the same element.
For example:
$('#div1').bind('click',function(){ // code runs first }); $('#div1').bind('click',function(){ // code runs second }); But what if I want the 2nd bound code to run first?
.
My current solution
Currently, my solution is to modify the event queue:
$.data(domElement, 'events')['click'].unshift({ type : 'click', guid : null, namespace : "", data : undefined, handler: function() { // code } }); .
Question
Is there anything potentially wrong with my solution?
Can I safely use null as a value for the guid?
Thanks in advance.
.