title: getelementbyid and tagname and classname
body: <p>I want to know how you can get element using pure javascript.</p>
  
  <p>I have my code below:</p>
  
  <pre><code>        &lt;html&gt;
               &lt;body&gt;
                   &lt;div id="abc" class="xy"&gt; 123 &lt;/div&gt;
                  &lt;p id="abc" class="xyz"&gt; 123 &lt;/p&gt;
                &lt;span id="foo" class="foo2"&gt; foo3 &lt;/span&gt;
               &lt;/body&gt;
             &lt;/html&gt;
  </code></pre>
  
  <p>Here i want to find element with combination:</p>
  
  <ol>
  <li>find element has id abc and tagname p</li>
  <li>find element has id abc and classname xy</li>
  <li>find element has classname foo2 and tagname span</li>
  <li>find element has id abc and classname xy and tagname div</li>
  </ol>
  
  <p>I know we can't use more than one id per page. But in worse situation is it ok to have same ID to different tags? in html?</p>