
- jQuery - Home
- jQuery - Roadmap
- jQuery - Overview
- jQuery - Basics
- jQuery - Syntax
- jQuery - Selectors
- jQuery - Events
- jQuery - Attributes
- jQuery - AJAX
- jQuery CSS Manipulation
- jQuery - CSS Classes
- jQuery - Dimensions
- jQuery - CSS Properties
- jQuery Traversing
- jQuery - Traversing
- jQuery - Traversing Ancestors
- jQuery - Traversing Descendants
- jQuery References
- jQuery - Selectors
- jQuery - Events
- jQuery - Effects
- jQuery - HTML/CSS
- jQuery - Traversing
- jQuery - Miscellaneous
- jQuery - Properties
- jQuery - Utilities
- jQuery Plugins
- jQuery - Plugins
- jQuery - PagePiling.js
- jQuery - Flickerplate.js
- jQuery - Multiscroll.js
- jQuery - Slidebar.js
- jQuery - Rowgrid.js
- jQuery - Alertify.js
- jQuery - Progressbar.js
- jQuery - Slideshow.js
- jQuery - Drawsvg.js
- jQuery - Tagsort.js
- jQuery - LogosDistort.js
- jQuery - Filer.js
- jQuery - Whatsnearby.js
- jQuery - Checkout.js
- jQuery - Blockrain.js
- jQuery - Producttour.js
- jQuery - Megadropdown.js
- jQuery - Weather.js
jQuery :image Selector
The :image selector in jQuery is used to select all the input elements of type "image".
The <input type="image"> element in HTML is an input element that acts as a submit button, but it displays an image instead of a regular button.
Syntax
Following is the syntax of :image selector in jQuery −
$(":image")
Parameters
Following are the parameters of this method −
- ":image" − This selector selects all <input> elements of type image.
Example 1
In the following example, we are using the :image selector to apply a blue border to all image input elements −
<html> <head> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function(){ $(":image").css("border", "3px solid blue"); }); </script> </head> <body> <form> <input type="image" src="https://www.tutorialspoint.com/cg/images/logo.png" alt="Submit Button"> </form> </body> </html>
After executing the above program, the image will be highlighted with a blue color solid border.
Example 2
In this example, we are adding a click event handler to the image input element using the :image selector −
<html> <head> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function(){ $(":image").click(function(){ alert("Image input clicked!"); }); }); </script> </head> <body> <form> <input type="image" src="https://www.tutorialspoint.com/cg/images/logo.png" alt="Submit Button"> </form> </body> </html>
When we click on th image, an alert will be displayed on the screen stating "Image input clicked".
jquery_ref_selectors.htm
Advertisements