Setting a control to readonly using jquery 1.6 .prop()
With the release of jQuery 1.6, the recommendation on SO has been to generally start using prop() where you used to use attr(). What happens when I want make an element readonly? $('.control').prop('readonly', 'readonly'); $('.control').prop('readonly', true); Neither of these seem to make the control readonly. Is making an element readonly the exception to the rule? The problem is that the property name is case-sensitive. Try: $('.control').prop('readOnly', true); Though really I don't know why this requires jQuery. This works just as well: document.getElementsByClassName("control")[0]