tags:

views:

27

answers:

1

On the click of a table row, I am performing some action.

However I want a filter to be applied. If my tr contains another tr or a table inside it, the click should not be valid for that row

$("#tbl1 tr").filter(function() {
    //?? 
}).click(function(){ 
    //alert
});

What do i write in the filter?

UPDATE: Never mind. I applied a class and solved it.

A: 

If you want to target <tr> nodes on sub-tables, use:

$("#tbl1 tr:not(:has(table))")

If you only want to target them on your main table, try:

$("#tbl1 > tbody > tr:not(:has(table))")

tbody is added to your table implicitly, that's why $(#tbl1").children("tr") didn't work.

See also: http://stackoverflow.com/questions/624018/jquery-tbody-question-asp-net

Kobi