Ticket #7184 (closed bug: invalid)
two tables make selector error
| Reported by: | ttndxjcm@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.4.3 |
| Component: | unfiled | Version: | 1.4.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
<div id="Abc"> <table border="1"> <thead><tr> <th>站別</th> <th>帳號</th> <th>類別</th> </tr></thead> <tbody> <tr> <td>98</td> <td>1234</td> <td>1234</td> </tr> </tbody> </table> <table border="1"> <thead><tr> <th>站別</th> <th>帳號</th> </tr></thead> <tbody> <tr> <td>98</td> <td>1234</td> </tr> </tbody> </table> </div>
$("table tr:gt(0)").live("mouseover mouseout", function(event) {
if (event.type == "mouseover") $(this).css("background-color", "#FFFF9E"); if (event.type == "mouseout") $(this).css("background-color", "#FFFFFF");
});
It should be colored from the 2nd tr tag in a table, but the 2nd table is colored from the 1st tr tag.
Something is wrong ?
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Your selector $("table tr:gt(0)") selects all tr elements except the first (zeroth) one.