title: Cannot Uncheck Checkbox (HTML)
body: <p>I am working on an autocomplete function using JavaScript for a form, and have run into a problem with the checkbox in my HTML file.  The basic idea is that the user should be able to fill out their shipping name and zip code in a form fieldset, and then if they check off "Is billing info the same?", a JS function will be called that fills in the billing fieldset for billing name and zip code with the same shipping values.  The checkbox is able to accomplish this, but I am unable to uncheck it to clear the billing info.  Essentially, I cannot uncheck my checkbox. My code is below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function billingFunction(){
    var billName=document.getElementById("billingName");
    var shipName=document.getElementById("shippingName");
    var billZip=document.getElementById("billingZip");
    var shipZip=document.getElementById("shippingZip");
    var same=document.getElementById("same");
  
    if (same.checked=true){
      billName.value=shipName.value;
      billZip.value=shipZip.value;
    }
    else{
      billName.value="";
      billZip.value="";
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Shipping Information&lt;/legend&gt;
          &lt;label for ="shippingName"&gt;Name:&lt;/label&gt;
          &lt;input type = "text" name = "shipName" id = "shippingName" required&gt;&lt;br/&gt;
          &lt;label for = "shippingZip"&gt;Zip code:&lt;/label&gt;
          &lt;input type = "text" name = "shipZip" id = "shippingZip" pattern = "[0-9]{5}" required&gt;&lt;br/&gt;
      &lt;/fieldset&gt;
  
      &lt;input type="checkbox" id="same" name="same" onchange= "billingFunction()"/&gt;
      &lt;label for = "same"&gt;Is the Billing Information the Same?&lt;/label&gt;
  
      &lt;fieldset&gt; 
          &lt;legend&gt;Billing Information&lt;/legend&gt;
          &lt;label for ="billingName"&gt;Name:&lt;/label&gt;
          &lt;input type = "text" name = "billName" id = "billingName" required&gt;&lt;br/&gt;
          &lt;label for = "billingZip"&gt;Zip code:&lt;/label&gt;
          &lt;input type = "text" name = "billZip" id = "billingZip" pattern = "[0-9]{5}" required&gt;&lt;br/&gt;
      &lt;/fieldset&gt;
          &lt;input type = "submit" value = "Verify"/&gt;
      &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>