InnerHTML vs jQuery html() - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:html

Description

InnerHTML vs jQuery html()

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.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from www .  ja  v  a2 s.c  o  m*/
        console.log($("div").html());
        console.log($("div").eq(2).html());
    });

      </script> 
 </head> 
 <body> 
  <div>
    html 1 
  </div> 
  <div>
    html 2 
  </div> 
  <div>
    html 3 
  </div>  
 </body>
</html>

Related Tutorials