jQuery first of type selector?

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

How would I select the first

element in the following

with jQuery?

heading

6条回答
  •  余生分开走
    2021-01-03 19:09

    This should work

    $( "div p:first-of-type" ).css( "font-size: 10px" );
    

    The above code finds the first paragraph in the div as @Denver pointed and changed its fonts-size to 10px

    Here is an example that explains even more about jQuery first-of-type selector

提交回复
热议问题