I was testing my script in IE 8 however its not working and i.e. it isn’t showing any errors. My script:
$(document).ready(function(){
var type = "hat";
$('select#itemtype').change(function() {
if($("select#itemtype option:selected").text(); == type) {
$('#graphic').show();
} else {
$('#graphic').hide();
}
});
}
You’ve added a semicolon after the text function which shouldn’t be there and you’re not closing the
.ready()function properly. Here is the fixed JS:Update: Added Baz1nga’s strict comparison suggestion.