I have an id with a dot ('.') . I am not able to select it using jQuery.
For example:
<p id="sec.ond">this is another paragraph</p>
How can I use such an id to select this element?
I get such ids while I use spring forms with arrays, e.g.:
<form:input path="abc[0].firstName" />
This will result in:
<form:input id="abc0.firstName" name="abc[0].firstName" />
Thanks in advance for any help.
You can escape it to select it in jQuery.
Example:
$('#sec\\.ond').doSomething()
Fiddle: http://jsfiddle.net/maniator/C7qhF/
See Also: How do I get jQuery to select elements with a . (period) in their ID?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With