I was under the impression that I could get the value of a select input by doing this $(this).val();
and applying the onchange
parameter to the sel
I was under the impression that I could get the value of a select input by doing this $(this).val();
This works if you subscribe unobtrusively (which is the recommended approach):
$('#id_of_field').change(function() {
// $(this).val() will work here
});
if you use onselect
and mix markup with script you need to pass a reference to the current element:
onselect="foo(this);"
and then:
function foo(element) {
// $(element).val() will give you what you are looking for
}