I want to change the value of value
using a change
event listener. Is it possible? Here is my sample code:
<select name="select1" onchange="updatevariable(this.value)">
<option value="2" >2</option>
<option value="15" >15</option>
</select>
<script type="text/javascript">
value = "test";
function updatevariable(data) {
value = data;
}
alert(value); // It should be 2/15
</script>
See Question&Answers more detail:os