gpt4 book ai didi

javascript - jquery源错误

转载 作者:行者123 更新时间:2023-11-28 11:10:39 25 4
gpt4 key购买 nike

我有一个 jquery 例程,在调试过程中,错误消息来自 jquery 源文件。我正在使用 google cdn 托管文件版本 1.7.1/jquery.min

错误提示

Uncaught Error: Syntax error, unrecognized expression: ''

这里是 jquery 源代码的代码区域(格式化后的第 1530 行):

 m.filter = function(a, c, d, e) {
var f, g, h, i, j, k, l, n, p, q = a, r = [], s = c, t = c && c[0] && m.isXML(c[0]);
while (a && c.length) {
for (h in o.filter)
if ((f = o.leftMatch[h].exec(a)) != null && f[2]) {
k = o.filter[h], l = f[1], g = !1, f.splice(1, 1);
if (l.substr(l.length - 1) === "\\")
continue;
s === r && (r = []);
if (o.preFilter[h]) {
f = o.preFilter[h](f, s, d, r, e, t);
if (!f)
g = i = !0;
else if (f === !0)
continue
}
if (f)
for (n = 0; (j = s[n]) != null; n++)
j && (i = k(j, f, n, s), p = e ^ i, d && i != null ? p ? g = !0 : s[n] = !1 : p && (r.push(j), g = !0));
if (i !== b) {
d || (s = r), a = a.replace(o.match[h], "");
if (!g)
return [];
break
}
}
if (a === q)
if (g == null)
m.error(a);
else
break;
q = a
}
return s
}, m.error = function(a) {
throw new Error("Syntax error, unrecognized expression: " + a) //ERROR LINE!!

jquery.min.js:3 未捕获错误:语法错误,无法识别的表达式:'' };

我的代码:

$(document).ready(function(){
debugger;
$("tr").each(function() {
var id = $(this).attr('id');
var count=1;
if (id == "row" + count){
// var tdvalue = $('#depcode1').text();
var tdvalue = $("'#depcode" + count + "'").text();
if (tdvalue != null){
//if (tdvalue != ""){
$(this).removeClass('hiderows');
count++;
}
}
});
});

最佳答案

也许尝试改变:

var tdvalue = $("'#depcode" + count + "'").text();

致:

var tdvalue = $("#depcode" + count).text();

关于javascript - jquery源错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8359420/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com