Passing a text string via jQuery - Javascript jQuery

Javascript examples for jQuery:String

Description

Passing a text string via jQuery

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">
    $(function(){/*from   w w  w . j ava  2 s.  c  o  m*/
$("span").text(function(i,_text){
  return $('li').eq(i).text();
})
    });

      </script> 
   </head> 
   <body> 
      <ul> 
         <li>#1</li> 
         <li>#2</li> 
      </ul> 
      <span></span> 
      <span></span>  
   </body>
</html>

Related Tutorials