Simple IF Statement

$(function () {
if( $(“select.country option:selected”).val() != ‘United States’){
$(‘.state’).attr(‘disabled’,‘disabled’)
}
});

This function does disable the state drop down menu, but if I select United States, it does not enable the state field. I’m assuming it is because the country option is not select, selected. I’m not sure how to say… When the United States gets clicked (selected) set the United States to $(‘’).attr(‘select’,‘selected’);

Please help.

You need the other side of the logic: “if country is United States, remove the ‘disabled’ attribute”. Presumably this has to happen when the user does something with the dropdown:

$(function () {
  var country = $("select.country"), state = $('.state');
  if (country.val() != 'United States'){
     state.attr('disabled','disabled');
  }
  country.change(function() {
    if ($(this).val() === 'United States') {
       state.attr('disabled', '');
    }
  });
});