HTML DOM Input Text disabled प्रॉपर्टी का उपयोग यह सेट या वापस करने के लिए किया जाता है कि टेक्स्ट फील्ड को अक्षम किया जाना चाहिए या नहीं। यह बूलियन मानों का उपयोग करता है जिसमें true दर्शाता है कि एलिमेंट को अक्षम किया जाना चाहिए और false अन्यथा। disabled प्रॉपर्टी डिफ़ॉल्ट रूप से false पर सेट होती है। अक्षम एलिमेंट डिफ़ॉल्ट रूप से ग्रे आउट होता है और अनक्लिकेबल होता है।
सिंटैक्स
Disabled प्रॉपर्टी सेट करने का सिंटैक्स:
textObject.disabled = true|false;
यहां, true = टेक्स्ट फील्ड अक्षम है और false = टेक्स्ट फील्ड अक्षम नहीं है। यह डिफ़ॉल्ट रूप से false है।
उदाहरण
Input Text disabled प्रॉपर्टी का एक उदाहरण देखते हैं:
<!DOCTYPE html> <html> <body>
<h1>Input Text disabled Property</h1>
USERNAME: <input type="text" id="TEXT1" autofocus>
<p>DISABLE बटन पर क्लिक करके ऊपर वाले टेक्स्ट फील्ड को अक्षम करें</p>
<button type="button" onclick="disableText()">DISABLE</button>
<p id="Sample"></p>
<script>
function disableText() {
document.getElementById("TEXT1").disabled = true;
document.getElementById("Sample").innerHTML = "The text field is now disabled";
}
</script>
</body> </html>
आउटपुट
यह निम्नलिखित आउटपुट उत्पन्न करेगा:

DISABLE बटन पर क्लिक करने पर, टेक्स्ट फील्ड अक्षम हो जाएगा:
