How to detect all events added on a div


Tags: javascript,jquery,html,css

Problem :

I am new to jQuery and such kind of js frameworks. Till now I used to do like this

<div onclick="function()"></div>

But in jQuery we get the element and add the event there. How can I detect all events added on a div?

I have a div whose height is set to the remaining height. Then I cant find appropriate css for that. I strongly believe that it has been done from javascript. I cant find relavant code any where. I dont know how to debug this.

Any help is highly appreciated.



Solution :

To answer your question you can use:

jQuery._data( elem, "events" );

This will become an object of all events attached to the selected element.

enter image description here

This will return undefined when no event is attached to the element.

Note that this should be a single element, so for a class you should use:

$._data($('.class')[0], "events")

Which only select the first element with that class, instead of all the elements with that class.

jsFiddle


Source: jQuery find events handlers registered with an object


    CSS Howto..

    How to set the styles on “*” and pseudo states with JavaScript? [closed]

    How do I mask a region of the page in a responsive design using CSS?

    Third-Level Menu Items Are Always Showing

    How to use grunt sass to compile and compress scss to css?

    How to correctly switch images with javascript?

    How to add multiple style rules to css pseudo elements using js?

    Resharper: How to suppress inspection errors resulting from CSS hacks?

    How to make divs float on both ends of another div?

    How to make shapes with CSS which have borders?

    How to apply css inside a text that is either any html control or without any html control

    How to achieve no outside margins for floats in a div

    How can I make a different CSS for the first child
    ?

    css boxes are not shown in the right place (when adding doctype)

    How does the arrival of HTML5 and CSS3 affect jQuery?

    Why css3 slideshow does not work

    How to display results comming from database in 3 columns using php/mysql/html/css

    How best to use jQuery: with HTML or CSS for formatting

    What is SVG and how does it work?

    How to apply css on one html file only

    How to use scaleable pixels in css

    HTML CSS How to stop a table cell from expanding

    how can I shape the image size according to its nested box

    How to following a link without modifying the displayed url and triggering css animation?

    How to align div blocks to be aligned in grid?

    how to place last div into right top corner of parent div? (css)

    How to keep button active after press with jQuery

    html web shows header only in mobile view

    How to put the text at the center of inner div?

    How to force inline-block wrap to new line using CSS or jQuery?

    How to separate form with horizontal line