Add Class in jQuery and Select the added New Class - Javascript jQuery Selector

Javascript examples for jQuery Selector:class

Description

Add Class in jQuery and Select the added New Class

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.6.2.js"></script> 
  <script type="text/javascript">
    $(function(){//  ww w.  jav  a  2 s. com
$(".theLink").live("click", function(){
  $(this).addClass("live");
    return false;
});
$(".live").live("click", function(){
  console.log("YO!");
    return false;
});
    });

      </script> 
 </head> 
 <body> 
  <a href="#" class="theLink">Click here</a>  
 </body>
</html>

Related Tutorials