how to use first selector in jquery - part 16

preview_player
Показать описание
This video explains how to use first selector in jquery.

as we know that jquery basic filters (:first, :last, :eq) can be used in conjunction with jquery basic selector( p tag, h2 tag, etc).

jquery first selects the first matched DOM element based on the applied selector ( p tag, h2 tag )

Example :

find me the first p tag in the html document.

code = $("p:first")

find me first h2 tag on the html document.

code = $("h2:first")

if you look at carefully my selectors are keep on changing and first filter is doing the right job.

I will try cover all the possible basic filters as much as possible. rest you can take it as a homework :-)

1. :first = done
2. :last = next
3. :eq
4. :gt
5. :lt
6. :odd
7. :even
8. :not
9. :header
10. :focus
11. :lang
12. :root

In case while trying few things if you get stuck some place then please do comment below and let me know.

I will try to reply you as soon as possible.
Рекомендации по теме
join shbcf.ru