Forums

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

Home Forums JavaScript jQuery: if tr row count?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #40239
    StephBertha
    Participant

    Hi there!

    I’m working on something like this:
    http://jsfiddle.net/yGM3m/

    But it won’t work. It’s displaying the “before” and “after” dom manipulations on both tables, when I only want it on the second table.

    I think I’m close. Help?

    #111613
    mweldan
    Member

    i don’t really understand what you want to achieve.

    for this:

    > It’s displaying the “before” and “after” dom manipulations on both tables, when I only want it on the second table.

    you can put different element id

    http://jsfiddle.net/yGM3m/1/

    #111614
    TheDoc
    Member

    You had a couple of problems going on. For starters, you had two divs with the same ID, this is a big no no. In my example I have changed them to classes.

    Secondly, your comparison looked like this `rowCount = 7` which will *always* return true. What you were looking for is either `rowCount === 7` or `rowCount >= 7`.

    http://jsfiddle.net/yGM3m/2/

    #111615
    TheDoc
    Member

    I also added an `each()` loop if you are going to have multiple dimension tables on a single page.

    #111622
    StephBertha
    Participant

    @mweldan – Sorry that I may have written my post incoherently. TheDoc has done what I needed. Thank you, though!


    @TheDoc
    – That’s exactly what I was looking for. Actually, I added the two ID’s on Jsfiddle, but the 2 tables won’t be on the page at the same time. :) Thank you! I knew I was close, but the operators were off.

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