...">

Select elements with periods in ID using jQuery?

I have id with dot ('.'). I cannot select it using jQuery.

For instance:

 <p id="sec.ond">this is another  paragraph</p>

How can I use such an identifier to select this item?

I get such identifiers while I use spring forms with arrays, for example:

<form:input path="abc[0].firstName" />

This will lead to:

<form:input id="abc0.firstName" name="abc[0].firstName" />

Thanks in advance for your help.

+5
source share
2 answers

You can avoid it to select it in jQuery.

Example:

$('#sec\\.ond').doSomething()

Fiddle: http://jsfiddle.net/maniator/C7qhF/
See Also: How to get jQuery to select items using. (period) in their ID?

+5
source

, , :

$('#sec\\.ond')

. " , , CSS?" FAQ jQuery.

+3

All Articles