I have a dom element that contains a fully qualified name as part of the id attribute;
My Div
If you can change the ID within your HTML code, find some other separator than a backslash \
for your ID so that you can make a valid ID for your selector (see here). An underscore _
would be good.
If you can't alter the HTML, jQuery can still work with backslashes in IDs and ID selectors. Except, you'll need to use four backslashes to match each literal backslash in your ID selector:
$('#domain\\\\element\\\\div')
You achieve this by
Taking the ID:
domain\element\div
Adding the #
symbol and escaping the backslashes for the selector:
#domain\\element\\div
Escaping each pair of backslashes for use in JavaScript strings by doubling them (also notice the quotes):
'#domain\\\\element\\\\div'
Then passing the string to $()
as above.
jsFiddle