title: How to make an input field readonly
body: <p>I want to make the input field readonly. The below code is working for me. But, if the page is refreshed the input fields will become readonly and I cant enter anything in the input field. I want that to become readonly only after the data is present in the input field.</p>
  
  <pre><code>      const disableInputs = function() {
        sessionStorage.disableInputs = 'true';
        document.getElementById('firstname').disabled = true;
        document.getElementById('lastname').disabled = true;
        document.getElementById('email').disabled = true;
        document.getElementById('mew').disabled = true;
        };
        if (sessionStorage.disableInputs === 'true') disableInputs();
        document.getElementById('myButton').onclick = disableInputs;
  </code></pre>
  
  <p>Any help is much appreciated.Thank you</p>