This is my code inside document.ready:
var $inputs = mySelectors();
$inputs.each(function() {
$(this).attr("readonly", "true");
});
This code works for IE8, but not for FF3.5
IE output(as seen with IE Developer toolbar)<input type="text" readOnly="readonly"..../>
FF output (seen with Firebug)
<input type="text" readonly="">
What is the right way to set it ?
$elem.attr("readonly","true");
or
$elem.attr("readonly","readonly");
or
$elem.attr("readOnly","readonly"); //note the uppercase O in Only
Looks like there was an old bug but not sure if it got resolved. http://osdir.com/ml/jquery-dev/2009-05/msg00115.html
reference:http://api.jquery.com/attr/
Cross-browser consistency: Some attributes have inconsistent naming from browser to browser. Furthermore, the values of some attributes are reported inconsistently across browsers, and even across versions of a single browser. The .attr() method reduces such inconsistencies.
IS there a way to tackle this cross browser inconsistency ?