<div id="selected_options">
<select onchange="test()" id="selected_options">
<option value="0" selected>-Select-</option>
<option value="1">Communication</option>
<option value="2">Hardware</option>
</select>
</div>
i had written a function for selected value , but when i'm doing alert of selected value it showing up undefined , the function is
function test() {
var get_id = document.getElementById('selected_options');
var result = get_id.options[get_id.selectedIndex].value;
alert(result);
}
any one please tell me what is the error?