jQuery <1.9$('#inputId').attr('readonly', true);
jQuery 1.9+$('#inputId').prop('readonly', true);
Read more about difference between prop and attr