In my view
<ul>
<li id="list">
<table cellpadding="0" cellspacing="0" width="100%" class="grid-table08" id="table1">
<tbody>
<tr><td><img src="../../Content/Images/downarrow.gif" title="Hide Details" class="hide">
</td></tr>
<tr><td align="left" valign="top" width="15" nowrap="nowrap">
Hii good morning
</td>
<tr>
</table>
</li>
<li>
<table cellpadding="0" cellspacing="0" width="100%" class="grid-table08" id="table1">
<tbody>
<tr><td><img src="../../Content/Images/downarrow.gif" title="Hide Details" class="hide">
</td></tr>
<tr><td align="left" valign="top" width="15" nowrap="nowrap">
Hii good evening
</td>
<tr>
</table>
</li>
</ul>
There are total 10 li when i click the image with id hide i need to hide the particular li
my script as follows
<script type="text/javascript">
$(function () {
$(".hide").live("click", function () {
$(".hide").closest("li").hide("slow");
});
});
but its not working anyone pls help me
Your img tags has an ID=”hide” instead of CLASS=”hide”.
UPDATE:
Also, you have multiple LI tags with the same ID=”list”:
<li id="list">You have to use a class:
<li class="list">The difference between an ID and a class is that an ID can be used to identify one element, whereas a class can be used to identify more than one.
SOLUTION:
and
Try the demo here: http://jsfiddle.net/RtXn9/