I have a select field that is dynamically populated with an ajax call that simply returns all the HTML select options. Here is the part of the PHP that just echo's the select tags and dynamically fills out each option/value.
echo "<select name='player1' class='affector'>";
echo "<option value='' selected>--".sizeof($start)." PLAYERS LOADED--</option>";
foreach ($start as $value) {
echo "<option value='".$value."'>".$value."</option>";
}
echo "</select>";
}
After this list is populated, I'm trying to call a change event, so that whenever the default option is changed in the SELECT list or in a text field with the same class, it disables a radio button set in another part of the form. (You can see the initial question I asked to get this part of the functionality working here)
$('.affector').change(function(){
$(this).parents('tr').find('input:radio').attr('disabled', false);
});
For some reason, even though I give the select field the proper class name (affector), when I select different options in the field, the other parts of the form do not disable. The static text field with the same class works fine. I'm stumped.
Any ideas?
echo "<option value='".$value."'>"
, try:echo "<option value='$value'>"
. If you're accessing an array, you can doecho "<option value='{$values[0]}'>"
– Darksome