How to use span tag in JQuery? Explain with example?

span tag is very important while doing work with particular positions in HTML DOM. In this example, I am giving one example, how to use span tag with one alert message.
<html>
<head>
    <title></title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
            <script type="text/javascript">
                $(document).ready(function () {
                    alert($('span').text()); // Alerts "Ranga Rajesh Kumar"
                });
    </script>
</head>
<body>
    <span>Ranga</span> <span> Rajesh</span> <span> Kumar</span> <span>!</span>

</body>
</html>


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