Jquery 尝试筛选字段时出错
我正在尝试根据以前的选择筛选一个选择字段,但该字段不起作用,它会给我一个错误: 未捕获错误:语法错误,无法识别的表达式: optgroup[标签=门到门销售]Jquery 尝试筛选字段时出错,jquery,html,ruby-on-rails,Jquery,Html,Ruby On Rails,我正在尝试根据以前的选择筛选一个选择字段,但该字段不起作用,它会给我一个错误: 未捕获错误:语法错误,无法识别的表达式: optgroup[标签=门到门销售] 您的浏览器似乎无法呈现当前jquery。 试一试 我猜它缺少双引号。因此,我将双引号改为单引号,并在after[和before]中添加了双引号 options = $(companies).filter('optgroup[label="' + industry + '"]').html(); 它不起作用。我检查,它说在HTMLsele
您的浏览器似乎无法呈现当前jquery。 试一试
我猜它缺少双引号。因此,我将双引号改为单引号,并在after[和before]中添加了双引号
options = $(companies).filter('optgroup[label="' + industry + '"]').html();
它不起作用。我检查,它说在HTMLselect元素。VM3376 select button.js:8是不是我弄乱了其中一个名字,而它不知道要更改什么?
jQuery(function() {
var companies;
companies = $('#companies').html();
console.log(companies);
return $('#affiliation').change(function() {
var industry, options;
industry = $('#affiliation :selected').text();
options = $(companies).filter("optgroup[label=" + industry + "]").html();
console.log(options);
if (options) {
return $('#companies').html(options);
} else {
return $('#companies').empty();
}
});
});
options = $(companies).filter("optgroup<label=" + industry + ">").html()
options = $(companies).filter('optgroup[label="' + industry + '"]').html();