I have a couple of input boxes that get dynamically created, and then filled. When I try and read these, I just get “undefined” as an answer. This pisses me off, because the same code works everywhere on other places on my web app.
The code I use for grabbing the value looks like this:
$('#box1.1').val()
So this SHOULD return the value of element with id = “box1.1”, am I right?
Firebug console:
>>> $('#box1.1').val()
undefined
And yes, I do use jQuery. Version 1.6.2.
Thanks in advance!
You should escape the dot with two backslashes so jQuery doesn’t treat
.1as a class.http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_by_an_ID_that_has_characters_used_in_CSS_notation.3F