Grow your CSS skills. Land your dream job.

jQuery: if tr row count?

  • # October 10, 2012 at 4:25 pm

    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?

    # October 10, 2012 at 4:33 pm

    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/

    # October 10, 2012 at 4:53 pm

    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/

    # October 10, 2012 at 4:54 pm

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

    # October 10, 2012 at 7:08 pm

    @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)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".