javascript - JS function not getting dropdown text -
i have dropdown form have created - need have dropdown either auto-generated text box once selected or have placed in text box once button has been pressed. example "get hex"
here dropdown:
<fieldset> <legend>logos</legend> <p> <label>choose desired logo</label> <select id = "logo"> <option value = "00">holden</option> <option value = "01">hsv</option> <option value = "02">chevrolet</option> <option value = "02">chevrolet</option> <option value = "04">csv</option> <option value = "05">pontiac</option> </select> <input type="button" value="show hex" onclick="displayselecteditem(val);" /> </p> <p> <input type="text" id="logo" /> </p> </fieldset>
and here last js script i've tried. have tried few surely missing nothing command works.
<script language="javascript" type="text/javascript"> <!-- function displayselecteditem(val) { alert(val); } //--> </script>
so need text box contain hex code in <option value = "##">
i'll using throughout 6 different forms, needing same thing.
change
<input type="button" value="show hex" onclick="displayselecteditem(val);" />
to
<input type="button" value="show hex" onclick="displayselecteditem(document.getelementbyid('logo').value);" />
Comments
Post a Comment