JDV590
JDV590

Reputation: 651

Jquery source error

I have a jquery routine and in the process of debugging an error message comes from the jquery source file. I am using google cdn hosted file version 1.7.1/jquery.min

The error says

Uncaught Error: Syntax error, unrecognized expression: ''

here is the area of code from the jquery source source (line 1530 when formatted):

 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 Uncaught Error: Syntax error, unrecognized expression: '' };

My code:

$(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++;
            }
        }
    });
});

Upvotes: 0

Views: 4114

Answers (3)

Distdev
Distdev

Reputation: 2312

it seems you have excess quotes:

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

try this:

$("#depcode" + count).text();

Upvotes: 3

James Hill
James Hill

Reputation: 61812

The problem is probably with the code below - you don't need to nest your quotes:

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

Change it to:

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

Upvotes: 3

Sean Bright
Sean Bright

Reputation: 120644

Maybe try changing:

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

To:

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

Upvotes: 6

Related Questions