开发者

Uncaught exception: Syntax error, unrecognized expression jQuery

开发者 https://www.devze.com 2023-04-12 03:21 出处:网络
I am having a few problems with jQuery 1.6, I am trying to select this object $(\'#开发者_高级运维\' + id) where id looks like skill|3345015|7868, but console always give me a :

I am having a few problems with jQuery 1.6, I am trying to select this object $('#开发者_高级运维' + id) where id looks like skill|3345015|7868, but console always give me a :

Error : uncaught exception: Syntax error, unrecognized expression: |3345015|7868

Thanks for your help


Try -

$("div[id='skill|3345015|7868']")

You'll have to replace 'div' with whatever element you're searching for. Or, to search all elements -

$("*[id='skill|3345015|7868']")

Demo - http://jsfiddle.net/dV7xM/


According to w3.org

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

So basically you have an invalid ID and that should be the reason for the parse error

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号