image selector in jQuery with example



Image selector returns all input elements with type image.


Example :



    <html>
    <head>
    <title>image 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()
    {
    $(":image").css("height","20px");
    });
    });
    </script>
    </head>
    <body>
    <input type="image" src="k.jpg" />
    <button type="button" id="myButton">Click Me</button>
    <button onclick="location.reload()">Reset</button>
    </body>
    </html>
    

Demo :





In the above example, we have used image selector. Image selector return all input elements with type image. In the above example the image selector selects the image and changes size of it.



0 comments:

Post a Comment