Use jquery API to append element and check result - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:append

Description

Use jquery API to append element and check result

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.8.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*www .ja va2  s.c o  m*/
var d = $('<div style="width:220px;height:200px;"></div>');
d.appendTo(document.body);
var w = d.width();
d.detach();
console.log(w);
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials