Find the very next sibling of each paragraph that has a class "selected". : Selector tag class « jQuery « JavaScript Tutorial






<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){

              $("p").next(".selected").css("background", "yellow");

        });
    </script>
  </head>
  <body>
    <body>
        <p>Hello</p>
        <p class="selected">Hello Again</p>

          
    </body>
</html>








30.11.Selector tag class
30.11.1.Finds every DIV element.
30.11.2.Finds the element with the class "myClass".
30.11.3.Finds the elements that match any of these three selectors.
30.11.4.Get last paragraph and add class
30.11.5.Select tag by name
30.11.6.Select tag and its class
30.11.7.Select from nested classes
30.11.8.Select based one just added
30.11.9.Matches all elements with the given class
30.11.10.Query just added tags
30.11.11.Find the very next sibling of each paragraph that has a class "selected".