jQuery first of type selector?

后端 未结 6 2016
独厮守ぢ
独厮守ぢ 2021-01-03 18:35

How would I select the first

element in the following

with jQuery?

heading

6条回答
  •  梦毁少年i
    2021-01-03 19:17

    $("div p").first();

    or $('div p:first');

    Reference: http://api.jquery.com/first/

    Keep in mind that first() matches only a single element, the :first-child selector can match more than one: one for each parent.

提交回复
热议问题