Add tag returned from document.getElementById : add « 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").add(document.getElementById("a")).css("background", "yellow");


        });
    </script>
  </head>
  <body>
    <body>
          <p>Hello</p>
          <p id="a">Hello</p>
  </body>
</html>








30.12.add
30.12.1.Add tag returned from document.getElementById
30.12.2.add(expr): adds more elements
30.12.3.Adds one or more Elements to the set of matched elements(document.getElementById)
30.12.4.Add class to the result returned from an add function