Results 1 to 2 of 2

Thread: Set focus on specific value within dropdown box

Hybrid View

  1. #1
    Join Date
    Oct 2012

    Set focus on specific value within dropdown box

    I am learning javascript on the fly and would like to know how to set the focus to a specific value in a select box when it is selected.

    Here is my code for the select box (in the case, selAMIBetDose is the select box I am displaying) :

    if (selectedValue == "AtenololQD") {
    document.getElementById('selAMIBetDose').style.display = ""
    document.getElementById('selAMIBetDose_1').style.display = "none"
    document.getElementById('selAMIBetDose_2').style.display = "none"
    document.getElementById('selAMIBetDose_3').style.display = "none"


    I would just like to add some type of focus line in this script to get the focus to one of the values in the dropdown.

  2. #2
    Join Date
    Oct 2012
    I got the answer. I had focus but when I switched to a different select box and then came back to the original one I lost focus. I did not post all my code. Basically, I just had to empty the value of the select box I was not choosing in addition to setting display = none.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center