I'm working on a pre-written module for a site, and I need to target an element with the id test:two
. Now, this element has a colon in it, so jQuery is presumably and understandably seeing the 'two' as a pseudo class. Is there any way of targeting this element with jQuery?
Also, changing the ID is not possible. Believe me, if I could I would.
I've put together an example:
Simply escape the colon with a \\
:
$('#test\\:two');
See the docs: How do I select an element by an ID that has characters used in CSS notation?.