Mega Code Archive

 
Categories / JavaScript Tutorial / JQuery
 

Get HTML and Text from a p tag

< html>   <head>     <script type='text/javascript' src='js/jquery-1.3.2.js'></script>     <script type='text/javascript'> $(document).ready(   function() {    alert(      'HTML: ' + $('p').html() + "\n" +      'Text: ' + $('p').text()    )   } );     </script>   </head>   <body>     <p>       asdf. <i>asdf</i>     </p>   </body> </html>