Helge
Helge

Reputation: 833

jQuery hides everything although I tell it to show

Kind of hard to explain this problem in the title...

I would like to show the .rowOptions of the row entered by the mouse, but also hide all other instances of .rowOptions.

I have the following code, but it hides all elements. It seems like it executes the show() line before the hide() line.

How can I solve this?

$(".container_12").live('mouseenter', function() { 

    $(".rowOptions").hide(); 
    $(this).children(".rowOptions").show();

});

The markup is:

<div class="container_12">
    <div />
    <div />
    <div />
    <div class="rowOptions" style="display: none"; />
</div>

Upvotes: 0

Views: 75

Answers (1)

Tejs
Tejs

Reputation: 41236

Sounds like your selector is wrong. I'm willing to bet that $(this).children('.rowOptions') is returning 0 elements, and thus nothing is being shown.

Without knowing how your HTML is setup, it's hard to say for sure. I would suggest logging the count of items you get back or throwing an alert:

 alert($(this).children('.rowOptions').length);

Upvotes: 3

Related Questions