I'm trying to use jQuery to fire off a javascript function whenever the selected option changes in a dropdown list.
The options of this dropdown list (insurance carriers) change each time the form is filled out. Options are populated by an event from a previous form field (onblur when user enters a case number), php is used to query a database and populate the dropdown list with each potential insurance carrier. Different case numbers result in different insurance providers showing up as options in the dropdown list, so the options are never the same each time a user fills this form.
Like stated previously, after the options are populated I'm trying to call another js function when the user selects a different insurance carrier from the dropdown.
On page load, the html for the form dropdown looks like this, simple:
<tr>
<tr><td><span class="qText" name="insurer">2. Insurer:</span></td></tr>
<td><select class="qAns" name="insurer_a1">
<option>Please enter a case number</option>
</select></td>
</tr>
Once a case number is entered in a previous field, the dropdown populates with however many potential insurance carriers are available for that case.
I tried to use something like this:
<script>
$("#insurer_a1").change(function(){
getAdjuster1();
});
</script>
I also tried this:
$(function() {
$("#insurer_a1").change(function() {
getAdjuster1();
});
});
Is what I'm trying to do much more difficult than I anticipated, because the dropdown options are not static?