title: Call a function that is an attribute
body: <p>Is it possible to call a method that is an attribute?</p>
  
  <p>I mean, I have this input (this is created dynamically using jQuery as well when retrieving a list of companies using .get() ):</p>
  
  <pre><code>&lt;input type="checkbox" onclick="javascript:onWorksiteChecked(this,'Virtus Västerås AB, STOCKHOLM','1:201334661','5566109426');" value="1:201334661"/&gt;
  </code></pre>
  
  <p>I have a Select All method that will, as the name suggest Select All this and it's performed as</p>
  
  <pre><code>$("#ulworksites li input:checkbox").each(function() {
       if ($(this).attr('disabled') == false) {
          $(this).attr('checked', $("#ckbSelectAll").attr('checked'));
  
          // Fire onWorksiteChecked method here
          // &gt; as suggested by August Lilleaas in his answer
          $(this).click(); // &lt;-- when this executes I still have the input box to be unchecked, the line above is not perform
       }
    });
  </code></pre>
  
  <p>in the onclick attribute I get the javascript that I need to run for each input (to add that into a list and add the company to be imported, but how can I run it?</p>
  
  <pre><code>$(this).attr('checked');
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/jiBh9.png" alt="alt text"></p>
  
  <p>how can I execute that function?</p>
  
  <p>as an add-on, this image shows the list</p>
  
  <p><img src="https://i.stack.imgur.com/bncDO.png" alt="alt text"></p>
  
  <ul>
  <li>if user click in a checkbox, it will execute the call correctly and add this company into "a basket"</li>
  <li>if user selects all (code above) I want to change all inputs:checkbox to checked and perform the call on each one so I will reuse the code to add each element into "the basket"</li>
  </ul>
  
  <p><strong>Problem</strong></p>
  
  <p>The click event fires, but when it fires I still have that input box unchecked (witch will not execute the code right)</p>