SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DOM Dropdown list option value

    how do you return the selected option value with DOM

    <select name="ddlLanguages" id="ddlLanguages">
    <option value="1">Vietnamese</option>
    <option value="2">Spanish</option>
    <option value="4">Japanese</option>
    <option value="99">English</option>
    </select>

    var objDDLLanguages = document.getElementById("ddlLanguages");

    objDDLLanguages.selectedIndex just returns the array value...

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like this.
    Code:
    objDDLLanguages.options[objDDLLanguages.selectedIndex].value
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.


Bookmarks

Posting Permissions

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