I got a task to intercept when user clicks on navigation. There is navigation control that is 'enhanced' with jquery mobile. Whole thing is a mess (there is more than one event fired when navigation is clicked) and I am trying to find which element is triggering what. I am thinking of writing function that accepts jquery selector and recursively traverses all children and prints out all events and event handlers ( console.log($(elem).data('events');
).
Does any of you have this script already by any chance?
Done it myself.
var printOutEvents = function (selector) {
var parent = $(selector);
function printer(item) {
if (item.data('events') != undefined) {
console.log(item);
console.log(item.data('events'));
}
if (item.children().length > 0) {
$.each(item.children(),
function (i, it) {
printer($(it));
});
}
};
printer(parent);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.