javascript - Problem with Jquery addClass -


i having trouble implementing jquery .addclass() effect.

the script trying use looks this:

<script>     $(function(){            $('#top_right_size_large').click(function(){             $('#primary').addclass('large_content');         });     });     </script> 

i've looked @ documentation , checked of parenthesizes whatever reason doesn't add .large_content class when #top_right_size_large anchor clicked. ideas why wouldn't work way expect to?

just guess, anchor has href , when clicked, reloads page, try changing code below:

<script>     $(function(){            $('#top_right_size_large').click(function(e) {             e.preventdefault();             $('#primary').addclass('large_content');         });     }); </script> 

Comments