submit selector in jQuery with example



Submit selector returns all input elements with type submit.


Example :




    <html>
    <head>
    <title>submit Selector</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
    <script type="text/javascript">
    $(document).ready(function()
    {
    $("#myButton").click(function()
    {
    $(":submit").text("Hello World");
    });
    });
    </script>
    </head>
    <body>
    <button type="submit" id="submitButton">Submit</button>
    <button type="button" id="myButton">Click Me</button>
    <button type="button" onclick="location.reload()">Reset</button>
    </body>
    </html>
    

Demo :





In the above example, we have used submit selector. Submit selector return all input elements with type submit. In the above example the submit selector selects the submit button and changes its text on button click.

0 comments:

Post a Comment