Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery tr:even

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33953
    aoeui
    Participant

    hi guys,

    if you look at
    http://new.krsiak.cz/kontakt.php

    you will see that 3rd table named “Bankovn√≠ spojen√≠”
    has wrong even colour

    it should start white, gray, white, …
    but starts as gray :(

    I used

    I have no .class or ID there, pure HTML targeted via jQuery
    can’t really figure it out

    #85118
    jamygolden
    Member

    Perhaps the theads have something to do with it. Try

    $("tbody tr:even").addClass('even');

    (I used addClass() because I think it’s best to keep styling out of js)

    #85121
    wolfcry911
    Participant

    In fact the theads do come into play. Using tr:even finds every other row in the entire document – its not relative to an individual table. Your second table only ‘works’ because of the number of rows in the first table. Here’s the simple solution:

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.