Last updated on August 6th, 2017 at 03:16 pm.
Since I don’t have much time today, but I think I should write something for you to enjoy, I’ve decided to explain how to disable the input in a X/HTML form.Disabling the input to a form using XHTML or HTML is actually really easy, but it’s not very well known.
All you need is one little option added to the HTML, disabled=”true” and you’re in business.
So to put this in a scenario, maybe you want your users to submit a form, the ID for what they are submitting cannot be changed, but you want it shown as part of the form, maybe in your system it’s easier to insert into the database or to mail out this way.
For something like this:
You would have your input like this:
All you need is:
<label for="formID">This is your ID:</label> <input id="formID" value="1234" disabled="true" type="text" />
And there you go. If of course you need it to become editable, you could use JavaScript to change it, but I’ll go into that another time.
Leave a reply