HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("h1:last-child").css("color","green"); }); </script> </head> <body> <h1>jQuery :last-child Selector</h1> <p>This is paragraph</p> <p><strong>Note</strong>: No effect will take place as the last child is not h1 tag.</p> </body> </html>
OUTPUT
×

Save as Private