JQuery dot in ID selector?

jqueryjquery-selectors

Possible Duplicate:
How to select html nodes by ID with jquery when the id contains a dot?

I have a website that contains elements similar to this:

<p id="root.SomeCoolThing">Some Cool Thing</p>

I can not select the paragraph with jQuery like $('#root.SomeCoolThing') because jQuery thinks, SomeCoolThing is the class of an element with id="root".

How can I select this element with jQuery? I would like to avoid a construction like this:

$(document.getElementById('root.SomeCoolThing'))

Best Solution

Use the escaping rules from the jQuery selectors API as follows:

$('#root\\.SomeCoolThing') 

From the docs:

To use any of the meta-characters (such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~) as a literal part of a name, it must be escaped with with two backslashes: \\. For example, an element with id="foo.bar", can use the selector $("#foo\\.bar").