我现在正在编写javascript代码,其中一个声明是:
if ($(this).is(":select")) {
if ($(this).find("option").filter(":selected").length > 0) {
var txt__ = $(this).find("option:selected:eq(0)").val();
if ($.trim(txt__) != '') {
flag_ = true;
}
}
}
在Chrome Firefox和IE9上,没关系。但就7月8日而言,它一直告诉我'语法错误',有些人可以帮我解决这个问题吗?
答案 0 :(得分:0)
问题出在第一行:
if ($(this).is(":select")) {
编辑:修正了基于OP评论的回复
我相信
if ($(this).tagName.toLowerCase() == "select") {
或
if ($(this).is(":input[type=select]")) {
应该这样做。