I'm working on some HTML code written by someone else. I can't change it and he's carelessly created two different elements with same ID. I need to access one of them using JavaScript but getElementById won't work. They are both encased inside division with different classes. Is there any way to access one in JavaScript without causing a conflict?
Code:
<div class="header"> <div class="search"> <form name="form_seach" action="[I]my page[/I]" method="post"> <input type="text" id="search_key" name="search_key" value="" style="width:110px;" /> <input type="submit" name="submit_search" id="[B]submit_search[/B]" value="Search"/> </form> </div> </div>
Code:
<div class="aite_search"> <form name="site_seach" action="my page" method="post"> <input type="text" placeholder="Search..." id="search_key" name="search_key" value="" /> <input type="submit" name="submit_search" id="submit_search" value="Search"/> </form> </div>
Comment