Specifically, an in memory dom of input type checkbox does not receive the ‘checked’ attribute (or any other checked indicator) in FireFox.
The commented line can be uncommented to see the test pass, but currently you will see the test fail in firefox.
var cb = $('<input type="checkbox" />')
//var cb = $('input');
if (cb.is(':checked')) alert("checkbox says it's already checked");
cb.click();
if (cb.is(':checked')) alert("checkbox clicked correctly!");
else alert("fail!");
Am I doing non-standard things? Any advice? I’m essentially relying on the jQuery .click to actually check my checkbox in the UI (and I don’t want to use .attr, .prop, .val because it will break my nice encapsulation that I got going on.)
Since you are using jQuery 1.4.3, it looks like your best bet will be:
jsFiddle Demo – tested in FireFox & Chrome & IE8
.click()doesn’t work in many strange situations in Firefox (it is something inherently wrong/different in that browser). I would assume because it isn’t actually available on the DOM yet, so it doesn’t know where this event would be. This is one of the many reasons things like.prop()exist, etc.