Typical noob question. :-) I looked at some of similar questions raised here, the solutions are too complicated for me to make them work. Or they don't really work? Anyway what this code does is it hides/shows the Province input when the option selected is USA/notUSA. The default selection is the option with value United states. To make it distinct from other options, I assigned a class=us to it and class=notus to others.
function showhideProvinceInput(){
if($("#countries option[class='notus']")){
$('#provincelabel').fadeIn("slow");
$('#provinceinput').fadeIn("slow");
}
if($("#countries option[class='us']")) {
$('#provincelabel').fadeOut(0);
$('#provinceinput').fadeOut(0);
}
}
$(document).ready(function(){
$('#countries').change(function() {
showhideProvinceInput();
});
});
It partially works, at least in "show" case. Partially because the input shows and then hides in 1 or so seconds. I have not tried hiding it because showing it doesn't fully work yet. :-) Any help?