jQuery代码:
$("#ProjectType").change(function(){
alert($("#ProjectType").val());
if($("#ProjectType").val() == '16' || $("#ProjectType").val() == '17' || $("#ProjectType").val() == '18' || $("#ProjectType").val() == '19' || $("#ProjectType").val() == '20' ||response $("#ProjectType").val() == '21' || $("#ProjectType").val() == '22' || $("#ProjectType").val() == '23' || $("#ProjectType").val() == '24' || $("#ProjectType").val() == '25' || $("#ProjectType").val() == '26' || $("#ProjectType").val() == '27'){
$("#BHKshow").hide();
alert('if');
}
else{
$("#BHKshow").show();
}
})
它在控制台中显示unexpected identifier
错误。如何解决此错误?
答案 0 :(得分:0)
试试这个:
$("#ProjectType").change(function(){
var projectValue = $("#ProjectType").val();
alert(projectValue);
if(projectValue == '16' || projectValue == '17' || projectValue == '18' || projectValue == '19' || projectValue == '20' || projectValue == '21' || projectValue == '22' || projectValue == '23' || projectValue == '24' || projectValue == '25' || projectValue == '26' || projectValue == '27'){
$("#BHKshow").hide();
alert('if');
}
else{
$("#BHKshow").show();
}
});