input type text disabled – How to disable an input type=text?

input type text disabled – This article will discuss how to disable and enable an input text box Example using jQuery/javaScript.

input type text disabled

we get to know how to disable an input type=text by using the input disabled attribute. To disable an input element, its disabled HTML attribute should be false.

Also Read This πŸ‘‰   jQuery Hierarchy Selectors List Example

document.getElementById('registrationname').disabled = true;


document.getElementById('registrationname').readOnly = true;

Disable and enable an input text box with JavaScript/jQuery

<div id="container">
    <label for="name">Enter your Member name:</label>
    <input type="text" id="registrationname" name="registrationname">
<button id="signup">Toggle</button>

$(document).ready(function() {
    var disabled = false;
    $('#signup').click(function() {
        if (disabled) {
            $("#registrationname").prop('disabled', false);       // if disabled, enable
        else {
            $("#registrationname").prop('disabled', true);        // if enabled, disable
        disabled = !disabled;


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

using jQuery

$('#registrationname')[0].disabled = true;


<input type="text" value="Pakainfo V1" readonly="readonly" />

Don’t Miss : HTML DOM Input Text Disabled/Enable Property

Also Read This πŸ‘‰   Dependent dropdown example in PHP MySQL

I hope you get an idea about input type text disabled.
I would like to have feedback on my
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.