Get and set name of the button using JQuery

Some time we need to change the button name using jQuery. It is very easy to do in Jquery. Please check see following example. Just copy and paste you will get output like below image.

Ouput:


Set and get button name using JQuery
Set and get button name using JQuery 



<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 () {
//author- Ranga Rajesh Kumar (aspnettutorialonline.blogspot.com)
                //seeting value of the button name
                    $('#btnName').val("Submit button");
                    //getting value of the button name. 
                    alert($('#btnName').val());
                });
            </script>
</head>
<body>
<input type="button" id="btnName"  />
</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