title: How to check a checkbox with boolean values
body: <p>So the HTML spec says that you should add a <code>checked</code> attribute to the <code>&lt;input type="checkbox"&gt;</code> tag to mark it as checked. But I only have a boolean <code>true</code> or <code>false</code> value. </p>
  
  <p>As by design, I can't add any logic to the boolean value before it get parsed to html :(. 
  Is it possible to check a Checkbox with a Boolean value on load just with html or js? I tried the following, but the <code>onload</code> seem not to trigger:</p>
  
  <pre><code>&lt;input type="checkbox" onload="javascript:this.checked=true" /&gt;
  </code></pre>
  
  <p>I know that I can do something like this in jQuery:</p>
  
  <pre><code>$("[checked='false']").prop('checked',false)
  </code></pre>
  
  <p>I am looking for an elegant way to solve it. This must parse the whole DOM-Tree and would slow down my page.</p>
  
  <hr>
  
  <p>Edit (trying to explain):</p>
  
  <p>In my company there exist a application that does the following by design:</p>
  
  <pre><code> &lt;input type="checkbox" checked="%IsValide%" &gt;
  </code></pre>
  
  <p>The Server than automatically replaces the <code>%IsValide%</code> var with a database value. Here true or false. But then the checkbox is always checked, even if the value is false. I am aware that this is because of the design of html5: checked="true" and checked="false" will marke the checkbox always as checked.</p>
  
  <p>Now I'am searching for a solution to use the true or false value from <code>%IsValide%</code> to check the box correctly with javascript (or even better, with html.). I can use the <code>%IsValide%</code> at any position in the html tag. For example:</p>
  
  <pre><code>&lt;input type="checkbox" onload="javascript:this.checked=%IsValide%" /&gt; 
  </code></pre>
  
  <p>But I <strong>can not</strong> add logic before it get parsed to HTML like this:</p>
  
  <pre><code>if(%IsValide%) {
   %IsValide%="checked";
  }
  else {
   %IsValide%="";
  }
  </code></pre>