How to create tag and tag attributes and append to body using JQuery?

Using below program, We can able to paragraph tag to the HTML body with text and attribute.



<!DOCTYPE>

<html>
<head>
    <title>How to Create Paragraph Dynamically using JQuery</title>
        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
</head>
<body>
    <script>
        $('<p></p>').text('this is paragraph example from http://jqueryexamplecode.blogspot.com').appendTo('body');

        $('<p></p>').text('this is second paragraph example from http://jqueryexamplecode.blogspot.com').attr('id','paragraphtext').appendTo('body');
    </script>
</body>
</html>




If you have any queries or suggestions, please feel free to ask in comments section.
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar