I have a list of 2 values in dropdown list as…
<select id="prop">
<option value="Caa:123">Ca</option>
<option value="Cb:745">Cb</option>
</select>
…and in javascript i used…
var p = document.getElementById('prop');
var q = p.options[p.selectedIndex].value;
alert(q);
…but I am not getting no alert and an error “Index or size is negative or greater than the allowed amount” code: “1 ”
Kindly help I trapped in this problem
Try like this: