jQuery selectors with meta-characters
Posted
by steamboy
on Stack Overflow
See other posts from Stack Overflow
or by steamboy
Published on 2010-03-21T23:58:47Z
Indexed on
2010/03/22
0:01 UTC
Read the original article
Hit count: 930
Hello Guys,
I'm having problem selecting an element with an id like this <li ="0f:Bactidol_Recorder.mp4">.
I tried using the function that escapes meta-characters with two backslashes below from this jquery link but still can't select the element
Function:
function jq(myid) {
return '#' + myid.replace(/(:|\.)/g,'\\$1');
}
Example:
$(jq('0fb:Bactidol_Recorder.mp4')).empty()
Output:
$(#0fb\\:Bactidol_Recorder\\.mp4).empty();
© Stack Overflow or respective owner