How to escape “:”?
问题 for example I have id like someform:somepanel:somebutton When I do jQuery("#someform:somepanel:somebutton") it returns someform, how to AUTOMATICALLY escape that id? EDIT: I want to do something like this jQuery(somefunction("#someform:somepanel:somebutton")) 回答1: If it's only this very specialized version, you can just .replace() the character. function somefunction(selector) { return selector.replace(/:/, '\\\\:'); } jQuery(somefunction("#someform:somepanel:somebutton")) is then converted