On Feb 18, 9:24 pm, rics <[EMAIL PROTECTED]> wrote:
> I don't even know where the problem is exactly. Please, if you could
> show me some way to go...
>
> I want to check the checkbox that have the specifc ID. Here is my
> code:
>
> if (sgconfs.default_domain != '') { $
> ("#"+sgconfs.default_domain).attr("checked", "checked"); }
>
> Ok. The sgconfs is an object. The value of is sgconfs.default_domain
> correct. This come from a MySQL database, via JSON, etc.
>
> When the value in database is "dom_89", for example, it works fine.
> The checkbox is checked as expected. The other value I have is
> "exatati.intranet". Well, when this is what I have in mysql the code
> don't work. The checkbox isn't checked...
>
> I look the W3C specification and the value of an id can contain the
> period.
>
> wierd!
>
> What that could be? How can I solve this issue? Any thoughts?

Not that weird at all actually. For the second value - the one with
the period in it - take a closer look what the selector looks like
after the variable has been evaluated:

"#exatati.intranet"

In CSS a period has special meaning and denotes a class selector. Thus
the selector "#exatati.intranet" will match an element with the id
"exatati" and the class "intranet". Not exactly what you want.

See FAQ for solution:
http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F


--Klaus

Reply via email to