Selector question
Selector question
I don't understand why I'm getting:
uncaught exception: Syntax error, unrecognized expression: Syntax error, unrecognized expression: j_id1\\
- // {!$Component.bla.bal} comes from the platform I'm working with, not a jquery thing.
- var elmId = "#{!$Component.theComponent.theForm.theValue}";
- // elmId now holds a string of: j_id0:j_id1:theComponent:theForm:theValue
- // do a replace to escape all colons in the id.
- elmId = elmId.replace(/:/g,"\\\\:");
- // elmId now holds a string of: j_id0\\:j_id1\\:theComponent\\:theForm\\:theValue
- // when I do this I get the exception
- $(elmId).val('foo');
- // but when I do this without escaping, everything works great
- $('input[id='+elmId+']').val('foo');
So I have a workaround but I'm trying to understand why $(elmId) throws an exception. Any thoughts?