html:
<tr id="tr">
<td>Somthing</td>
<td>Somthing</td>
<td>Somthing</td>
<td>Somthing</td>
</tr>
Jquery
$("#tr").click(function(){
// something happen
});
so, the question is:
the click effect obviously will get all the stuffs inside the <tr>
can the click effect just happen when i click in the first 3 td’s inside the <tr> ?
edit:
if i have more then 1 tr
<tr class="tr">
<td>Somthing</td>
<td>Somthing</td>
<td>Somthing</td>
<td>Somthing</td>
</tr>
<tr class="tr">
<td>Somthing</td>
<td>Somthing</td>
<td>Somthing</td>
<td>Somthing</td>
</tr>
the solution td:lt(4) will only work in the first tr
ps.: i neeed to identify the tr, because i have another stuffs around the code working with tr’s
my real code is this:
$(".class td:lt(6)").live("click", function(){
});
Try using the lt (less than) selector.
UPDATE:
You can assign a class name that will be same on all rows, and an individual id to each td. See updated example above