开发者

How can I tell what events are bound to an object?

I am using jqGrid (http://www.trirand.com/blog/) to display some read-only data. The resizeable columns are interfering with other draggable elements on the page (they get stuck when dragged over the region where the columns can be resized).

I want to unbind() wh开发者_如何学编程atever is allowing the columns to be resized, presumably on mouseover, but I can't figure out how to determine what callbacks the objects currently have.


$('body').click(function(){ alert('test' )})

var foo = $.data( $('body').get(0), 'events' ).click
// you can query $.data( object, 'events' ) and get an object back, then see what events are attached to it.

$.each( foo, function(i,o) {
    alert(i) // guid of the event
    alert(o) // the function definition of the event handler
});

Copied from my previous answer @ jQuery check if event exists on element

Just adopt it to fit your selector

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜