how to use first selector in jquery - part 16

how to use first selector in jquery - part 16

dnanetwork

54 года назад

212 Просмотров

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.

Тэги:

#jquery_first_selector #how_to_use_first_selector_in_jquery #why_to_use_first_selector #what_is_first_selector_in_jquery #first_selector #first_selector_in_jquery #using_first_selector #using_first_selector_in_jquery #first_selector_jquery #first_selector_javascript #jquery_first #jquery_last
Ссылки и html тэги не поддерживаются


Комментарии: