Friday, 15 January 2010

How to pass Id of a div that is clicked to a function that handles the click in jQuery -


I want my Divi ID to be consistent with the items in a database, based on the ID, the appropriate content from my app database Will pull.

So when I handle one click (), Then I am clicked on the function to pass the ID of the division that handles it. How do i do this

Your click inside the event handler function, reference ( This keyword) refers to the DOM element that triggers the event, for example: you $ ('div [id]'). Click on (function () {// all divs in which id attribute var id = this.id; // or $ (this) .attr ('id'); some other functions (id);});


No comments:

Post a Comment