求人大神告诉下
$(function () {
$("#seltest").change(function () {
if ($(this).val() == "苹果")
$(this).addClass("red");
else
$(this).addClass("green");
})
});
.red 和.green 我都定义好了 可是最后运行 苹果也是绿色的啊 全变成绿色的了 为什么啊??难道只能用CSS么?
$(function () {
$("#seltest").change(function () {
if ($(this).val() == "苹果")
$(this).addClass("red");
else
$(this).addClass("green");
})
});
.red 和.green 我都定义好了 可是最后运行 苹果也是绿色的啊 全变成绿色的了 为什么啊??难道只能用CSS么?
2015-08-08
举报