Selecting Form Elements by Type - J Query

You need to select form elements based on their types (hidden, text, checkbox, etc.).


jQuery gives us a bunch of useful filters for this very purpose, as shown in Table (jQuery form filters).

Table : jQuery form filters

So, as an example, if you needed to select all text inputs, you would simply do this:
There is also an :input filter that selects all input, text area, button, and select elements.


Note that the :hidden filter, as discussed earlier, does not test for the type hidden; it works by checking the computed height of the element. This works with input elements of the type hidden because they, like other hidden elements, have an off set Height of zero.
As with all selectors, you can mix and match as desired:

These filters can also be used with regular CSS syntax. For example, selecting all text
input elements plus all <textarea>elements can be done in the following way:

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

J Query Topics