title: Checkbox input - onclick event - change href and checkbox image/value
body: <p>I have this checkbox: </p>
  
  <p><a href="https://i.stack.imgur.com/ctP3P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ctP3P.png" alt="enter image description here"></a></p>
  
  <p>This is code for checkbox:</p>
  
  <pre><code>&lt;input class="ace ace-switch"
         data-toggle="tooltip"
         data-placement="top"
         value="true"
         type="checkbox"
         id="checkBoxId"
         onclick="switch();" &gt;
  </code></pre>
  
  <p>On click i want change href(url) and based on that url I hide/show some other element on page.</p>
  
  <p>This is code for <code>onclick</code> event:</p>
  
  <pre><code>function switch() {
      location.href="../../app/?viewMode=&lt;%= viewMode.equals("presentation")?"full":"presentation" %&gt;"
  }
  </code></pre>
  
  <p>On click href(url) is changed and elements is hide or show but switch image always stay off. </p>
  
  <p><a href="https://i.stack.imgur.com/kQkvA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kQkvA.png" alt="enter image description here"></a><a href="https://i.stack.imgur.com/fA4iG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fA4iG.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/g1s0c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g1s0c.png" alt="enter image description here"></a><a href="https://i.stack.imgur.com/mbeMO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mbeMO.png" alt="enter image description here"></a></p>
  
  <p>Why? </p>