Jquery select this + class

How can I select a class from that object this?

$(".class").click(function(){
        $("this .subclass").css("visibility","visible");
})

I want to select a $(this+".subclass"). How can I do this with Jquery?


Use $(this).find(), or pass this in context, using jQuery context with selector.

Using $(this).find()

$(".class").click(function(){
     $(this).find(".subclass").css("visibility","visible");
});

Using this in context, $( selector, context ), it will internally call find function, so better to use find on first place.

$(".class").click(function(){
     $(".subclass", this).css("visibility","visible");
});

Maybe something like: $(".subclass", this);


Use find()

$(this).find(".subclass").css("visibility","visible");

What you are looking for is this:

$(".subclass", this).css("visibility","visible");

Add the this after the class $(".subclass", this)