e.g. “Live” version here: http://jsfiddle.net/Ltmbd/5/
<html>
<body>
<select id="some.list" >
<option value="1" >AAA</option>
<option value="2" >BBB</option>
</select>
</body>
</html>
and corresponding javascript/jquery:
$(function()
{
$("select").each(function()
{
$(this).val("2");
});
});
This should select “BBB” in the select list (and if you remove the ‘.’ from the ID “some.list”, it works as expected). Note that the jquery FAQ mentions a related but slightly different problem.
The obvious answer is “don’t put a . in your IDs” – however I’m using scaffolded (generated) grails views, so it would be a lot of work to go against this convention.
Using Jquery 1.4.4
jQuery versions above 1.4.4 will do the trick.
consider updating your jQuery version and your problem should be solved, thanks.
Here is the original bug reported, and the case is that it’s solved with the 1.5 release.
http://bugs.jquery.com/ticket/8021