Exploring jQuery Selectors
page 9 of 11
by Nihar Ranjan Nayak
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 44688/ 146

Forms Selectors

These type of selectors are used to match elements based on the element name.

:input

This will find all input, buttons, text area and select elements.

                   $(":input")

This finds all the input elements.

:text

This matches all input elemets that are of type text i.e. text boxes. The syntax is like this :

                   $(":text")

This selector is equivalent to $("*:text"). These type of selectors are considered to be slower selectors. So it is recommended to always use $("input:text"). So that first it will match all the input elements and then will match for the text boxes in all the input elements in stead of finding in the whole document.  So this becomes more convinient.

 

:password

This matches all password elements or controls.  The syntax is :

                   $("input:password")

So it finds input controls which are of password type.

:radio

This matches all input elements of type radio.

This selector is equivalent to $("*:radio"). These type of selectors are considered to be slower selectors. So it is recommended to always use $("input:radio"). So that first it will match all the input elements in and then will match for the radio buttons in all the input elements in stead of finding in the whole document.

                   $("input:radio")

:checkbox

This Matches all input elements of type checkbox.

                   $(":checkbox")

This selector is equivalent to $("*:checkbox"). These type of selectors are considered to be slower selectors. So it is recommended to always use $("input:checkbox"). So that first it will match all the input elements in and then will match for the checkboxes in all the input elements in stead of finding in the whole document.

:submit

Matches all input elements of type submit. This is the syntax :

                        $(":submit")

It will not match the button controls which are type button. It only matches the buttons which are type submit.

:image

Matches all input elements of type image. The syntax is

                        $(":image")

:reset

Matches all input elements of type reset. The syntax is :

                   $(":reset")

This will match all the reset type buttons which are generally used to clear out all the elements in the page.

:button

This matches all button elements and input elements of type button.

                   $(":button")

This will find the button controls which are written like <button></button> and the input elements of type button like <input type='button'> as well.

:file

Matches all input elements of type file.

                        $(":file")

This will find all the file type controls used for uploading files in a page.

:hidden

This will find all the hidden elements.

                   $("input:hidden")

The above code will find all the hidden input elements.


View Entire Article

User Comments

Title: good   
Name: 00
Date: 2010-01-28 10:44:36 PM
Comment:
thanks
Title: Request   
Name: Pls write more article on JQuery
Date: 2009-05-12 6:46:55 AM
Comment:
Hello Nihar
Please write more articles on JQuery.
Tume lekha ame sahajare khali padhi kam akribu
How is the IDEA?
Excellent Idea...
Title: Ureka   
Name: Lulu
Date: 2009-05-11 10:26:46 AM
Comment:
Really I have been searching this type of article for last 2 months.Thank you Nihar.
Title: Excellent boss   
Name: Sumoon
Date: 2009-05-11 10:23:15 AM
Comment:
Excellent Article boos.Please post tghis type of usefull articles more

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-03-24 5:48:25 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search