Horje Website
Selecting All the Following Sibling Elements in jQuery – Learn Get all the siblings next to an element – jQuery Code

Selecting All the Following Sibling Elements in jQuery – Learn Get all the siblings next to an element

Selecting All the Following Sibling Elements in jQuery - Learn Get all the siblings next to an element - jQuery Code


 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Selecting All the Following Sibling Elements in jQuery</title>
  6. <style>
  7. .highlight{
  8. background: yellow;
  9. }
  10. </style>
  11. <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
  12. <script>
  13. $(document).ready(function(){
  14. $("p").nextAll().addClass("highlight");
  15. });
  16. </script>
  17. </head>
  18. <body>
  19. <div class="container">
  20. <h1>Hello World</h1>
  21. <p>This is a <em>simple paragraph</em>.</p>
  22. <p>This is another paragraph.</p>
  23. <ul>
  24. <li>Item One</li>
  25. <li>Item Two</li>
  26. </ul>
  27. </div>
  28. </body>
  29. </html>



Try Your Self ->



Published:
September 16, 2020
Author:
admin
Category:
jQuery Advanced, jQuery Source Code
Views:
17

This article was posted in jQuery Advanced, jQuery Source Code and tagged , , . Bookmark the permalink. Follow comments with the RSS feed for this post.Post a Comment or leave a trackback: Trackback URL.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Horje © 2011 - 2022