Create DOM element from jQuery selector - Javascript jQuery

Javascript examples for jQuery:Tag Traversing

Description

Create DOM element from jQuery selector

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://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){//from  w ww  .  j  av  a 2  s  .co  m
$('#test').after("<div id='hello' class='a b'>Hello</div>");
    });

      </script> 
   </head> 
   <body> 
      <div id="test">
         This element already existed in the DOM.
      </div>  
   </body>
</html>

Related Tutorials