jquery readonly code example
Example 1: jquery set attribute readonly
// jQuery < 1.9
$('#id').attr('readonly', true);
// jQuery >= 1.9
$('#id').prop('readonly', true);
Example 2: add readonly attribute jquery
$(input).attr('readonly', true);
Example 3: how to set element readonly using jquery
To make an input readonly use: $("#fieldName"). attr('readonly','readonly');