first-child Selector- jQuery

$( “:first-child” ) – selector is used to select the first child of its parent.

Syntax : first-child Selector using jQuery

first-child Selector- jQuery Example

<!DOCTYPE html>
<title>first-child Selector- jQuery Example</title>
 <script type="text/javascript" src="">
<script type="text/javascript">
          $("ol li:first").css("border","4px solid red");
          $("ol li:first").css("color","blue");
          $("ol li:first").css("font-size","26px");
<a href="javascript:void(0)" id="demo"> 
Click Me
  <li> First Item </li>
  <li> Second Item </li>
  <li> Third Item </li>

Try it »


Add Comment

📖 Read More