var branches = $('#branch_name').html();
var filtrate = optgroup[label="Abe's Milk"]
var options = $(branches).filter(filtrate).html();
我明白了:
throw new Error ( "Syntax error, unrecognized expression: " + msg );
但是如果我输入:
var filtrate = optgroup[label="Abes Milk"]
没有错误。
我尝试使用正则表达式自动转义 Abe's 中的单引号,但这也失败了,因为没有 optgroup 与 Abe\'s Milk 匹配。
请帮忙。谢谢!
最佳答案
I tried automatically escaping the single quote in Abe's with a regular expression, but this failed as well because no optgroup matched Abe\'s Milk.
尝试:
optgroup[label="Abe\'s Milk"]
关于javascript - 使用特殊字符进行 Optgroup 过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10782778/