AddClass onClick won't work

Posted by QTaylor on Stack Overflow See other posts from Stack Overflow or by QTaylor
Published on 2013-07-01T22:45:09Z Indexed on 2013/07/01 23:05 UTC
Read the original article Hit count: 124

Filed under:
|
|
|
|

I'm having some problems getting some simple jQuery to work; I'm trying to add a class called fadeInLeft to my body element on click. Here's the code:

$('.contact-button').click(function() {
    $('body').addClass('fadeInLeft')
});

HTML (from comment left by OP, below):

<div id="contact" class="bounceInRight animated four">
    <a href="#" class="contact-button"> Say Hello </a>
</div><!--End of contact-->

contact-button is the class of the link, fadeInLeft is the class I want to add when the link is clicked. Any idea why this would not work ?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html