Re: [jQuery] Get element ID

2006-10-21 Thread smeranda
Perfect, that is what I needed! Thank you very much! -Seth Glen Lipka wrote: Not sure if it makes a difference..but I think this would work too $(document).ready(function() { $(td).click(function() { var id = $(this).attr(id) http://this.id/; // now do

[jQuery] Get element ID

2006-10-20 Thread smeranda
How do I get the id of the item which was just clicked? For instance, if a user clicks a td which has a specific id, how do I use this id in my script? $(document).ready(function() { $(td).click(function() { // get the id of the table cell clicked // use the id in a

Re: [jQuery] Get element ID

2006-10-20 Thread John Resig
Something like this: $(document).ready(function() { $(td).click(function() { var id = this.id; // now do stuff with id! }); }); --John How do I get the id of the item which was just clicked? For instance, if a user clicks a td which has a specific id, how

Re: [jQuery] Get element ID

2006-10-20 Thread Adam van den Hoven
Keep in mind that this refers to the element on which the event is being handled, NOT the element that originated the event. See http://www.quirksmode.org/js/events_order.html for an explaination of how events are captured and http://www.quirksmode.org/js/events_properties.html for good measure.