I want to disable td with this content ‘CLICKING MUST BE DISABLE’ and clicking on ‘CLICK HEAR 1’ works correctly but is not working ‘CLICK HEAR 2’
JQUERY:
$("#chart tr:odd").addClass("odd");
$("#chart tr.odd").click(function()
{
$(this).next("tr").toggle();
});
HTML:
<table id="chart">
<tbody>
<tr class="odd">
<td height="25" width="200px"><b>TABLE 1</b> </td>
<td colspan="6">CLICKING MUST BE DISABLE</td>
</tr>
<tr class="odd">
<td style="padding-right: 30px;" width="100px"></td>
<td style="background-color: rgb(237, 237, 237);" width="200px">CLICK HEAR 1</td>
<td height="25">
</td>
</tr>
<tr style="display: none;">
<td></td>
<td colspan="4">
sssss<br>sssss<br>sssss<br>sssss<br>sssss<br>sssss<br>sssss<br>sssss<br>
</td>
</tr>
<tr class="odd">
<td height="25" width="200px"><b>TABLE 2</b> </td>
<td colspan="6">CLICKING MUST BE DISABLE</td>
</tr>
<tr>
<td style="padding-right: 30px;" width="100px"></td>
<td style="background-color: rgb(237, 237, 237);" width="200px">CLICK HEAR 2</td>
<td height="25">
</td>
</tr>
<tr class="odd" style="display: none;">
<td></td>
<td colspan="4">
sssss<br>sssss<br>sssss<br>sssss<br>sssss<br>sssss<br>sssss<br>sssss<br>
</td>
</tr>
</tbody>
</table>
You are using the
:oddselector but the row you want to select is not an odd row.The following jsFiddle shows a working example: http://jsfiddle.net/2rDww/
I have manually added the
oddclass to the two rows that should be clickable. You can remove the first line that adds the odd class to all the odd rows.