14 9 / 2011
Escaping ID selector in jQuery
If you are using a framework like JSF/Struts which generates ids like
id=”form:myButton” or id=”form.myIput[1]” and want to use these ids in jQuery, it would complain “unrecognized expression :myButton”.
Escape it with double backslashes like this
$(“#form\\:myButton”) or $(“#form\\.myInput\\[1\\]”)
Permalink 1 note