title: How to make a readonly text field writable using JavaScript?
body: <p>I want to enable the text field (its id is <code>name_text_field</code>) when clicking the button (its id is <code>name_button</code>). But my code is not working.</p>
  
  <p>Here is my <strong>HTML</strong> code:</p>
  
  <pre><code>&lt;input type="text" id="name_text_field" readonly="readonly" value="name"&gt;
  &lt;button id="name_button" onclick="enableTxt()" style="color: #009dcd; color: #009dcd; border: none; background-color: #ffffff;"&gt;name&lt;/button&gt;
  </code></pre>
  
  <p>Here is my <strong>JavaScript</strong> code:</p>
  
  <pre><code>function enableTxt() {
    document.getElementById("name_text_field").disabled = false;
  }
  </code></pre>