I am loading a select via AJAX and then trying to use the value of the select for another AJAX call.
So I have:
<select id ="thisSelect">
<option value = "someValue1"> Some Value 1 </option>
<option value = "someValue2"> Some Value 2 </option>
</select>
This loads fine. Then I am trying to access the value of thisSelect like so:
$(document).ready(function(){
var value = $('#thisSelect').val();
alert(value);
});
It only registers the first value that the select loaded with in the original AJAX call and isn't capturing any of the changes.
Any ideas? I tried:
$('#thisSelect').on('change', function() {
var value = (this.value);
//or
alert(this.value);
});
in the same $(document).ready block, but 'value' shows up as undefined and I don't get an alert box.