Bug Tracker

Modify

Ticket #7184 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

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

comment:1 follow-up: ↓ 2 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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

comment:2 in reply to: ↑ 1 Changed 3 years ago by ileadu <ttndxjcm@…>

Replying to dmethvin:

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

How to refine it to make every table color from 2nd tr tag ?

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.