I am using jQuery . I have some code like below -
----HTML-----
<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>
---JS----
$(".cell").click(function() {
do_something();
}
function do_something(){
// I want to print the id of the cell that was clicked here .
}
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()