Sunday, 18 August 2013

Is it possible to detect which line, or function triggered a jquery change event on an element?

Is it possible to detect which line, or function triggered a jquery change
event on an element?

I know there are manual ways round it, and I have Googled but can find no
automated way.
I have some fairly complex code where an element can be changed by jQuery
in a few different ways, for different reasons at different times during
the execution of the entire code depending on various things.
I am trying to locate an issue where it's changing incorrectly and am
having trouble working out exactly which change() event is changing where
it shouldn't.
Is there anyway where I can temporarily add something like:
$(document).on('change', '.myClass', function (e){
console.log(e.functionOrLineWhichTriggerThis);
});
For debugging/fault finding purposes?

No comments:

Post a Comment