I have an element with id=\"A B\". The following code fails:
While it’s technically invalid to have a space in an ID attribute value in HTML (see @karim79’s answer), you can actually select it using jQuery.
See http://mothereffingcssescapes.com/#A%20B:
jQuery uses a Selectors API-like syntax, so you could use $('#A\\ B'); to select the element with id="A B".
To target the element in CSS, you could escape it like this: