Query two elements from document.querySelectorAll() method - Javascript DOM

Javascript examples for DOM:Document querySelectorAll

Description

Query two elements from document.querySelectorAll() method

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {// w  w  w.jav  a 2 s .co m
console.log(document.querySelectorAll('#id1, #id2'));
    });

      </script> 
   </head> 
   <body> 
      <li class="product" name="RD-101" id="id1" price="18" quantity="2"> </li>
      <li class="product" name="RD-101" id="id2" price="18" quantity="4">  
      </li>
   </body>
</html>

Related Tutorials