Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript, Function when checkbox unchecked div is hidden, remember on page refresh
    primarykey
    data
    text
    <p>I still have the problem and i don't know how to fix it. thanks to the answers given i hava an idea of how it looks, but i don't know how to make it working.</p> <hr> <p>I have a problem with my javascript checkbox code.</p> <p>I have a function to hide a div (my other post: <a href="https://stackoverflow.com/questions/11015286/javascript-when-right-div-is-hidden-left-div-has-to-be-100-width">javascript, When right div is hidden left div has to be 100% width</a>)</p> <p>But when i refresh the page the checkbox will be checked again, i read something about cookies but i don't know how to implement this.</p> <p>My javascript code:</p> <pre><code>$(function() { $("#foo").on("click",function() { if ($(this).is(':checked')) $('#checked-a').show('fast',function() { $('#checked-b').css("width","60%"); $('#checked-a').css("width","38%"); }) ; else $('#checked-a').show('fast',function(){ $('#checked-b').css("width","100%").show(); $('#checked-a').css("width","0%").hide(); }); }); }); </code></pre> <p>My html code for the checkbox:</p> <pre><code>&lt;input type="checkbox" checked="checked" name="foo" id="foo" /&gt; </code></pre> <p>My Div's:</p> <pre><code> &lt;div class="content1" id="checked-b"&gt; &lt;%= button_to "Zoek", search_index_path, :method =&gt; :get, :class =&gt; 'contentlinks' %&gt; &lt;%= button_to "Print", root_url, :class =&gt; 'contentlinks' %&gt; &lt;%= button_to "Edit", root_url, :class =&gt; 'contentlinks' %&gt; &lt;%= button_to "Add", root_url, :class =&gt; 'contentlinks' %&gt; &lt;br&gt; &lt;div class="spacing"&gt; &lt;%= yield %&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="content2" id="checked-a"&gt; </code></pre> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload