Problem Overview
In jQuery, the order in which you bind the handler is the order in which they will execute if you bind 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 second related code to be run first?
.
My current solution
My current solution is to change the event queue:
$.data(domElement, 'events')['click'].unshift({ type : 'click', guid : null, namespace : "", data : undefined, handler: function() {
.
Question
Is there something potentially wrong with my solution?
Is it safe to use null as a value for guid?
Thanks in advance.
.
jquery jquery-plugins
resopollution
source share