Adding and finding classes dynamically added to body - Javascript jQuery

Javascript examples for jQuery:Tag Traversing

Description

Adding and finding classes dynamically added to body

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.3.js"></script> 
  <style id="compiled-css" type="text/css">

.border{
   border: 1px solid black;
}


      </style> 
  <script type="text/javascript">
    $(window).load(function(){//w  w w.  ja va2 s . c  o m
var a = $('<a>');
a.html('new link').appendTo('#menu');
a.addClass('border');
    });

      </script> 
 </head> 
 <body> 
  <div id="menu"></div>  
 </body>
</html>

Related Tutorials