How to call javascript function only when checkbox is checked
<p>i have tried this:</p>

<pre><code>    function stickyheaddsadaer() {
        $("#page-header-inner").addClass("sticky");
    }

    &lt;input type="checkbox" name="TT_sticky_header" id="TT_sticky_header_function" 
value="{TT_sticky_header}" onclick="stickyheaddsadaer()"/&gt;
</code></pre>

<p>so when i click checkbox, it just nothing happens....</p>

<p>but when i try this:</p>

<pre><code>function stickyheaddsadaer() {
    alert("I am an alert box!");
}
</code></pre>

<p>then works...</p>

<p>can you please help me ? I need to activate javasript function by checkbox</p>

<p>and when the js function is actived it add class to the div</p>

<p>Thank you</p>