I have two different elements with the same id. How do I select the div element with id="abc" in jQuery.
For example:
<select id="abc">
<option>jhon</option>
<option>Richard</option>
</select>
<div id="abc">
</div>
It is given, that you cannot have multiple identic ID on same page.
The page won't be (X)HTML Valid DOM Document
If you do it, then you can't find elements by their id using javascript call getElementById(String)
See references:
For targeting multiple DIV elements on page, use .class instead
<select class="abc">
<option>jhon</option>
<option>Richard</option>
</select>
<div class="abc">
</div>
and find them by jQuery library
var divCollection = $(".abc");
You CAN have multiple id's you should try to select it with the type of element you want $('select#abc') or $('div#abc'). You should never do it but its possible. I mean the word IDENTIFIER says it all or ;-) ?
idmultiple times on the page.