how to get id value with respect to class attribute.
- php.
-
- <table border="1" cellspacing="5" id="mytable">
<tr id="main_menu" class="main_menu">
<td id="4" class="main_category"> something </td>
- <td id="6" class="main_category"> something </td>
- <td id="7" class="main_category"> something </td>
- <td id="3" class="main_category"> something </td>
</tr>
</table>
jquery.
- $(".main_category").mouseover(function(){
var menu_id = $(".main_category").attr("id");
alert(menu_id);
});
hi above are my php and jquery code. I want to get value of id when i mouseover the specific td. Suppose if i mouseover on td having id 4 then i want to alert 4 and similarly if i mouseover on td having id 6 then i want it to alert 6 and so on. But it is alerting only 4(ie. first id of the td.). how can i obtain as i wish. this is what i have tried. thanks in advanced.