Lists, Getting The Value Selected.

Discussion in 'Web Design and Development' started by a4poster, Oct 15, 2010.

  1. a4poster macrumors newbie

    Sep 11, 2010
    Hi, how do I get the value of a list when a button is clicked. I can get the index of the Array by using:

    var list = document.getElementById("list").selectedIndex;

    But what I want to do is get the value that is held at that index, i.e, The Persons Name that is displayed.

    In a web browser I can get it working without any problems but in DashCode it throws an error.

    Thanks in advance, A4

    PS, Previously posted in the wrong forum - sorry.
  2. angelwatt Moderator emeritus


    Aug 16, 2005
    This is based on memory, but I believe you just access the value property.
    var list = document.getElementById("list").value;

Share This Page