Get select element value on event using pure JavaScript
.onchange = function() { ... }
seems to overwrite other handlers, so I use addEventListener("change", function() { ... })
A solution that will work with all browsers (including IE8) :
var select_element = document.getElementById('product-form-user-enquiry-type');
select_element.onchange = function() {
var elem = (typeof this.selectedIndex === "undefined" ? window.event.srcElement : this);
var value = elem.value || elem.options[elem.selectedIndex].value;
alert(value);
}
document.getElementById('test').onchange = function() {
alert(this.options[this.selectedIndex].value);
};
Does the above the work?
Edit:
Edited to reflect your select id's etc.
var select_element = document.getElementById('product-form-user-enquiry-type');
select_element.onchange = function(e){
if (!e)
var e = window.event;
var svalue = this.options[this.selectedIndex].value;
alert( svalue );
}
See it working at: http://jsfiddle.net/gRoberts/4WUsG/