Reputation: 237
My problem is quite simple. What I want to do in jquery is something like this:
$(this > ".otherDiv").show();
But it doesn't work and I have no idea why. I also tried:
$(this).$(".otherDiv").show();
$(this + ".otherDiv").show();
$(this ".otherDiv").show();
$(this.".otherDiv").show();
It works when I replace this with something else. And I tested and this is really the parent div I want. Is there something i'm doing wrong?
Thx!
Upvotes: 1
Views: 60
Reputation: 185933
This is the correct form:
$(this).children('.otherDiv').show();
Upvotes: 1
Reputation: 7544
My personal favourite is:
$(".otherDiv", this).show();
Which is an elegent, shorthand way of writing:
$(this).find('.otherDiv').show ();
Hope that helps :)
Upvotes: 1
Reputation: 7484
this
is not a jquery object, it is a Javascript one. Try something like this:
$(this).find('.otherDiv').show ();
Upvotes: 1