Updating a select box
Updating a select box
Working on these chained select boxes. I have three. Category, Watt, and Lamp. I am trying to get the last select box to change after the second one is selected. I am getting mixed up with the closing brackets and causes the first two to not work. At this point I wast just trying to get it to say "wait" or send an alert message. This is what I have.
- jQuery(document).ready(function() {
$("select#lamp").attr("disabled","disabled");
$("select#watt").attr("disabled","disabled");
$("select#category").change(function(){
$("select#watt").attr("disabled","disabled");
$("select#watt").html("<option>wait...</option>");
$("select#lamp").html("<option>wait...</option>");
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {action:"ajax_get_watts",id: $(this).val() },
success:function(data){
$("select#watt").removeAttr("disabled");
$("select#lamp").html("<option>Hold on...</option>");
$("select#watt").html(data);
//works up to this point
}
$("#select#watt").change(function(){
$("#lamp").attr("disabled","disabled");
$("#lamp").html("wait...");
}
- });
});
});
});