View Full Version : on focus after search

12-12-2011, 10:10 PM

I have a search textbox field which populates the results in a dropdown after searched.

But there is no way, to let users to explain to click or use the dropdown to see the results.. thus, I would like to have a focus on the dropdown, so after the user searches through the search textfield, and enter, the dropdown gets the focus so it will user friendly.

can anyone help me on this.
thank you in advance

Philip M
12-12-2011, 10:59 PM
Is this what you are seeking?

<script type="text/javascript">
function selSelect(which) {
document.forms[0].mySelectBox.selectedIndex = which;

The first index of the select list is of course 0, and if you always want that you can hard code it.

<script type="text/javascript">
function selSelect() {
document.forms[0].mySelectBox.selectedIndex = 0;
Quizmaster: What "G" is the national dish of Hungary?
Contestant: Goats

12-13-2011, 01:31 AM
im not sure, the dropdown i have

<asp:dropdownlist id="cmbpart" runat="server" datatextfield="number" datavaluefield="partnumber" Cssclass="label"></asp:dropdownlist>

and i get the values of dropdown from a search textfield results.