How to get span tag data using JQuery.

Using this program, we can able to learn how to access any tag data using JQuery. For example, i have taken span tag data. Please go through below example u can understand, how it works.


<html>
<head>
    <title>
      How to combine all span tags data using jquery
    </title>
     <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
</head>
<body>
    <span>This </span>
    <span>is </span>
    <span id="website">www.jqueryexamplecode.blogspot.com</span>
    <script>
    //combine all span tags data in the alert message
        alert($('span').text());
        //show only specific span data using id. 
        alert(jQuery('span#website').text());
    </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