title: How to maintain a red border around a text input after form submission?
body: <p>I have the following HTML:</p>
  <pre><code>  &lt;form id=&quot;contactInfo&quot; name=&quot;contactInfo&quot;&gt;
          &lt;label&gt;Name: &lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;name&quot;&gt;&lt;/input&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;label&gt;E-mail: &lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;email&quot;&gt;&lt;/input&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;label&gt;Message:&lt;/label&gt;&lt;br/&gt;
          &lt;textarea rows=&quot;10&quot; cols=&quot;80&quot; name=&quot;message&quot;&gt;&lt;/textarea&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;input type=&quot;submit&quot; name=&quot;sendMessage&quot; onclick=&quot;messageChecker()&quot;&gt;&lt;/input&gt;
        &lt;/form&gt;
  </code></pre>
  <p>And the following Javascript:</p>
  <pre><code> function messageChecker(){
          let x = document.forms[&quot;contactInfo&quot;][&quot;name&quot;].value;
          let y = document.forms[&quot;contactInfo&quot;][&quot;email&quot;].value;
          let z = document.forms[&quot;contactInfo&quot;][&quot;message&quot;].value;
          if (x==&quot;&quot; || y==&quot;&quot; || z==&quot;&quot;){
            alert(&quot;Please fill out the indicated field(s).&quot;);
            if (x==&quot;&quot;){
             document.forms[&quot;contactInfo&quot;][&quot;name&quot;].style.border = &quot;1px solid red&quot;;
            }
            if (y==&quot;&quot;){
             document.forms[&quot;contactInfo&quot;][&quot;email&quot;].style.border = &quot;1px solid red&quot;;
            }
            if (z==&quot;&quot;){
             document.forms[&quot;contactInfo&quot;][&quot;message&quot;].style.border = &quot;1px solid red&quot;;
            }
        
          }
        
        }
  </code></pre>
  <p>So I want the red border to appear when the form is submitted and a field isn't filled in; it appears for less than a second, then disappears, along with the entered text. How can I get it to stay?</p>