Toggle between classes on click jQuery - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

Toggle between classes on click jQuery

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from  w  ww  .  j a  va  2  s.  co  m
$('div.smallimage').click(function() {
    $(this).toggleClass('smallimage bigimage');
});
    });

      </script> 
 </head> 
 <body> 
  <div class="smallimage"> 
   <img src="http://www.java2s.com/style/demo/Firefox.png"> 
  </div>  
 </body>
</html>

Related Tutorials