anon271334
anon271334

Reputation:

slideDown Doesn't work for me

Why doesn't this jQuery code work?

    $(document).ready(function () {
        $('currentPage').click(function() {
          $('myaccount').slideDown('slow', function() {
            // Animation complete.
          });
        });
    });

<li><a class="currentPage">Home</a></li>
<li><a class="myaccount">My Account</a></li>

Anyone got any ideas? I don't.

Upvotes: 1

Views: 1423

Answers (2)

Nikita Rybak
Nikita Rybak

Reputation: 68006

We use dots to select classes: $('.class_name')

    $('.currentPage').click(function() {
      $('.myaccount').slideDown('slow', function() {
        // Animation complete.
      });
    });

In your version, it's looking for <currentPage> tag.

edit
An example.
It might seem 'not working' because myaccount link is already visible, so sliding it down won't change a thing. Thus, I've hidden it in the example above.

Upvotes: 2

corroded
corroded

Reputation: 21564

You're missing a . on your class selectors:

$('currentPage') should be $('.currentPage')

and

$('myaccount') should be $('.myaccount')

Upvotes: 1

Related Questions