Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Input Box - Disable

Tags:

html

input

what is the code to disable an INPUT text box for HTML?

Thanks

like image 803
David Bonnici Avatar asked Dec 16 '08 20:12

David Bonnici


People also ask

How do you turn off input in HTML?

The disabled attribute can be set to keep a user from using the <input> element until some other condition has been met (like selecting a checkbox, etc.). Then, a JavaScript could remove the disabled value, and make the <input> element usable. Tip: Disabled <input> elements in a form will not be submitted!

How do I disable a textbox?

We can easily disable input box(textbox,textarea) using disable attribute to “disabled”. $('elementname'). attr('disabled','disabled'); To enable disabled element we need to remove “disabled” attribute from this element.


2 Answers

<input type="text" required="true" value="" readonly="true"> 

This will make a text box in readonly mode, might be helpful in generating passwords and datepickers.

like image 43
kiruba Avatar answered Sep 22 '22 09:09

kiruba


<input type="text" disabled="disabled" /> 

See the W3C HTML Specification on the input tag for more information.

like image 108
Greg Avatar answered Sep 21 '22 09:09

Greg