To make an input readonly, simply use .prop
$("#fieldName").prop("readonly", true);
//or
$("#fieldName").attr('readonly','readonly');
To enable the input
$("#fieldName").prop("readonly", false);
//or
$("#fieldName").removeAttr('readonly');
What do you think?