title: Struts2: checkbox stuck as selected
body: <p>I am working on a website made with Struts2 and I am facing a problem with a checkbox.</p>
  
  <p>I have a dropdown with a list of companies. If the user does not find his company in the list, he can click a checkbox to replace the dropdown with a text field. Here is the code:</p>
  
  <p>Extract of the JSP:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td align="right" width="49%"&gt;
          &lt;table&gt;
              &lt;sj:select id="company_select" name="company_select" list="company_list" .../&gt;
          &lt;/table&gt;
      &lt;/td&gt;
      &lt;td colspan="2" align="left"&gt;
          &lt;table&gt;
              &lt;s:hidden name="company_text" id="company_text" label="Company Type" disabled="true"/&gt;
          &lt;/table&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td align=left&gt;
          &lt;s:checkbox name="checkboxCompanyText" id="checkboxCompanyText" label="Company Not in the List"
                                              fieldValue="false" onchange="showCompanyText()"/&gt;
      &lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>The JS function:</p>
  
  <pre><code>function showCompanyText() {
          if(document.querySelector('#checkboxCompanyText').checked = "true") {
              document.getElementById('company_text').type = "visible";
              document.getElementById('company_text').disabled = false;
              document.getElementById('company_select').style.display = "none";
          }else{
              document.getElementById('company_text').type = "hidden";
              document.getElementById('company_text').disabled = true;
              document.getElementById('company_select').style.display = "block";
          }
      }
  </code></pre>
  
  <p>When the page loads, the checkbox is unchecked, the dropdown is here and the text input field is not visible. Good. When I check the checkbox, the dropdown goes away and the text field appears. Again: good. But when I try to uncheck the checkbox, it just remains checked, impossible to uncheck it.</p>
  
  <p>If anyone has an idea of what's going on, you are welcome.</p>