last-child Selector- jQuery

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

Syntax : last-child Selector- jQuery

last-child Selector- jQuery Example

<!DOCTYPE html>
<title>last-child Selector- jQuery Example</title>
 <script type="text/javascript" src="">
<script type="text/javascript">
          $("ol li:last").css("border","4px solid red");
          $("ol li:last").css("color","blue");
          $("ol li:last").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