David Sousa
David Sousa

Reputation: 130

Selecting the element with this

I recently started study jQuery and developing a site, i have two dropbox elements with dropbox class.

<a href="#" class="dropbox">+</a>
<a href="#" class="dropbox">+</a>

I want the one that clicked slide down, but when i use the "this" selector the slide down doesn't work, can anyone help me explain why?

//slideDown() Method
$(".dropbox").click(function(){
    $("this").hide().slideDown();
});

Upvotes: 0

Views: 22

Answers (1)

Keammoort
Keammoort

Reputation: 3075

What you're looking for is this:

$(".dropbox").click(function(){
    $(this).hide().slideDown();
//    ^---^----------------------- no quotes
});

Example

Upvotes: 2

Related Questions