javascript - Programmatically keypress on a focused drop-down element without Jquery -
i'm trying press enter (programmatically) on drop down element. cannot use jquery. drop down in focus, want click enter open it. ideas how can achieved? here's html:
<select class="test"> <option value="1">item1</option> <option value="2">item2</option> <option value="3">item3</option> <option value="4">item4</option> <option value="5">item5</option> <option value="6">item6</option> </select>
and js got element focused:
document.getelementsbyclassname('test')[0].focus();
var element = document.getelementsbyclassname('test'); element.onclick.apply(element);