I want to simply disable a text field (specifically a "person/group" field text box) from being editable on the edit form page of my list item. I have it working in IE using a Content Editor Web Part with javascript using:
document.getElementById('myDivID').setAttribute("disabled","disabled");
This jQuery works as well in IE:
$('#myDivID').attr('disabled', 'disabled');
But neither of these work in Chrome or Firefox. The field is still editable in those browsers.
EDIT: Tried the suggestion of wrapping a CSS class around the div and disabling the class, but it still doesn't seem to work. Attempted code here:
var disableElement = $('#myDivID');
if(disableElement) {
disableElement.className = 'setDisabled';
}
$(".setDisabled:input").attr('disabled', true);
The class assignment looks to be working, but the last line seems to do nothing.