Home
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function () { $('p:last-child').append(" - This element is last child of its parent"); }); </script> </head> <body> <h1>CSS Selector: element:last-child </h1> <div> <p>Inside div - Paragraph 1</p> <p>Inside div - Paragraph 2</p> <p>Inside div - Paragraph 3</p> </div> <span> <p>Inside span tag - Paragraph 1</p> <p>Inside span tag - Paragraph 2</p> <p>Inside span tag - Paragraph 3</p> </span> </body> </html>
Result: