Monday, May 7, 2012

jQuery text(), get and set text

jQuert text(), get and set text


<!doctype html>
<head>
 <title>Mobile-Web-App: jQuert text(), get and set text</title>
 <meta charset="utf-8">
 <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
 <script type="text/javascript">

  $(document).ready(function(){
  
   var textin = $(".source").text();
   $("#dest").text(textin);

  });
 </script> 
 
</head>
<body>
<p><b>Mobile-Web-App: jQuert text(), get and set text</b></P>
<p class="source">Hello! </p>
<p class="source">Mobile</p>
<p class="source">-Web</p>
<p class="source">-App</p>
<p id="dest">-App</p>
</body>
</html>


Related:
- jQuery: .text() vs .html()


No comments:

Post a Comment