Javatpoint Logo
Javatpoint Logo

jQuery :file selector

The :file selector in jQuery is used to select the elements with the type = "file".

Syntax

The commonly used syntax of using the :file selector is given as follows -

The selector is used without any argument. A form can contain more than one file element. We can select any specific input element with type = "file" using the class or id of an element.

Let's see an illustration to understand the working of the :file selector.

Example

It is a simple example of using the :file selector. In this example, there are three input fields one is of type = "text", the other one is of type = "password", and the last one is of type = "file". On clicking the given button, the :file selector will select the input field with the type = "file".

Test it Now

Output

After the execution of the above code, the output will be -

jQuery :file selector

On clicking the given button, the background-color of the input field with type = "file" will be changed, as shown in the below screenshot -

jQuery :file selector





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA