Set char to div - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:text

Description

Set char to div

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.0.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from  ww w.  j  a  v a 2s . co m*/
var s = '01234';
$('#inbounds').text(s.charAt(2));
$('#outbounds').text(s.charAt(10));
    });

      </script> 
 </head> 
 <body>
   in bounds: 
  <div id="inbounds"></div> 
  <br> out of bounds: 
  <div id="outbounds"></div>  
 </body>
</html>

Related Tutorials