readonly attribute in jquery 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);