Form filters

As if all the previous selectors and filters weren't cool enough, you can also explicitly filter to several types of form elements as well as types of events for those elements. Using these filters, you'll be able to take control of your WordPress generated comment forms as well as custom and WordPress plugin forms and make them even more intuitive and easier to use. Later on in this book, we'll see how jQuery can make form use and validation dead simple.

Example

Syntax

Description

:input

jQuery("form:input").css( "#f60");

"background",

Filters to all input, text area, select, and button elements

:text

jQuery("form:text").css(" "#f60");

background",

Filters to all input elements that are of type text

:password

jQuery("form:password"). css("background", "#f60")

;

Filters to all input elements that are of type passwords

:radio

jQuery("form:radio").css( "#f60");

"background",

Filters to all input elements that are of type radio

:checkbox

jQuery("form:checkbox"). css("background", "#f60")

;

Filters to all input elements that are of type checkbox

:submit

jQuery("form:submit"). css("background", "#f60")

;

Filters to all input elements that are of type submit

:image

jQuery("form:image").css( "#f60");

"background",

Filters to all image elements (classified as a form filter, but useful for regular images)

:reset

jQuery("form:reset").css( "#f60");

"background",

Filters to all input elements that are of type reset

:button

jQuery("form:button")

Filters to all input

.css("background", "#f60"

);

elements that are of type button

file

jQuery("form:file").css(" "#f60");

background",

Filters to all input elements that are of type file

Using the following code, I've highlighted only the text input and submit buttons, as shown in the next screenshot:

jQuery(":text, :submit").css("background", "#f60");

jQuery(":text, :submit").css("background", "#f60");

Blog Your Way To The Top

Blog Your Way To The Top

How Any Business Builder Can Turn A Simple Blog Into A Lead Generating, Organization Cash Cow For Any Home Based Business! Everyone knows that in order to succeed in your home based business or your MLM / Network Marketing business, you need to adopt the latest strategies when it comes to making massive money.

Get My Free Ebook


Post a comment