Set to innerHTML via html() function - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:html

Description

Set to innerHTML via html() function

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-2.1.4.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from  w w w .ja v  a 2s  .co  m
$('#name1').text("YO");
$('#name2').html("<b>YO</b>");
    }

      </script> 
   </head> 
   <body> 
      <div id="name1"></div> 
      <div id="name2"></div>  
   </body>
</html>

Related Tutorials