/ Published in: JavaScript
f you wish to use any of the meta-characters ( such as !"#$%&'()*+,./:;?@[]^`{|}~ ) as a literal part of a name, you must escape the character with two backslashes: \. For example, if you have an an element with id="foo.bar", you can use the selector $("#foo\.bar").
Expand |
Embed | Plain Text
function jqescape(str) { return str.replace(/[#;&,\.\+\*~':"!\^\$\[\]\(\)=>|\/\\]/g, '\\$&'); }
You need to login to post a comment.
