Jquery - How do I access the element that was clicked to run a function?

djnet00

New Member
I am using jQuery . I have some code like below - ----HTML-----\[code\]<table> <tr><td class="cell" id="cell1" ></td><td class="cell" id="cell2"></td><td class="cell" id="cell3" ></td></tr><tr><td class="cell" id="cell4"></td><td class="cell" id="cell5"></td><td class="cell" id="cell6"></td></tr></table>\[/code\]---JS----\[code\]$(".cell").click(function() {do_something();}function do_something(){// I want to print the id of the cell that was clicked here . }\[/code\]How do I access the element that caused the function to be run ? For eg in the above code , I want to access the id of the cell that was clicked from inside the function do_Something()
 
Back
Top