Sometimes we don't want to make some form fields non-editable to users, like Product ID, Order Created Date, Post Author, etc.
For HTML text input and textarea controls, we can add "readonly" attribute to disallow users to modify their value, but this attribute will not work for checkbox control. So how should we disable the checkbox (or set it as readonly)? The "disabled" attribute will do the job
<input type="checkbox" checked disabled>
<input type="radio" disabled>
(It works for both radio box and checkbox)
You will see following checkbox and radio button is disabled: