JQuery gets the current click event for an element and adds to it

I use jqGrid and add my own onclick event to each data cell when the grid has finished rendering.

jqGrid has a default behavior highlighting the onclick line. When I add my own onclick event after rendering the grid, my event overwrites the jqGrid event, as expected. I would like to save the jqGrid onclick event and just add my event to it.

How can I get the current onclick event for all elements matching a specific class and just add extra actions to the event? This is the current new onclick event.

Thanks!

$(".searchOrders").click(function() {
    $('#tabs').tabs('url', 2, '/view/dspOrders.cfm?id_orders='+$(this).attr('title'));
    $('#tabs').tabs('select', 2);
});
+3
source share
3 answers

jQuery . :

 $("#button").click(function() { alert("hello"); });
 $("#button").click(function() { alert("goodbye"); });

, #, , .

- .

+3

jqGrid onCellSelect. jqGrid Docs

+3

you can adapt some code that I use to insert a load event:

// stack the original loads
var aryLoadQueue = new Array();
$.each($.data($main.get(0), "events").load, function() {
    aryLoadQueue.push(this);
});

...

// put the original loads back in place to take place after our one-time load
$(aryLoadQueue).each(function() {
    $main.load(this);
});

feel free to comment questions ...

0
source

Source: https://habr.com/ru/post/1715204/


All Articles