Make an input field read-only with jQuery

// jQuery

What it does

If you don’t have access to the markup for the input field, you can make it read-only via jQuery.

The Code

$(document).ready(function() { 
	$('#fieldID').attr('readonly', 'readonly'); // Replace #fieldID with your input field's ID

How To Use It

Paste this snippet into a JavaScript file that is loaded by your page, or you can put it between <script> </script> tags in the footer.

jQuery is required.