Home » jQuery :gt() selector

jQuery :gt() selector

by Online Tutorials Library

jQuery :gt() selector

The :gt() selector selects the elements that have a greater index value than the value specified in the index parameter of the :gt() selector. The index starts at 0.

We can use the :lt() selector to select the elements having lesser index value than the specified index.

Syntax

The index in the above syntax is the required parameter. The parameter specifies which element is to be selected. The elements that have a higher index value than the specified value will get selected.

Let’s see an illustration to understand the working of the :gt() selector.

Example

In this example, we are applying the :gt() selector on the table elements. Here, we are specifying the index value 4, so the selector will return the elements having an index value greater than 4.

Test it Now

Output

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

jQuery :gt() selector

After clicking the given button, the output will be –

jQuery :gt() selector


You may also like