Javascript storing data
<p>Hi I am a beginner web developer and am trying to build the interface of a simple e-commerce site as a personal project.The site has <strong>multiple pages with checkboxes</strong>.</p>

<p>When someone checks an element </p>

<ul>
<li>it retrives the price of the element and </li>
<li>stores it in a variable.</li>
</ul>

<p>But when I go to the next page and <strong>click on new checkboxes</strong> products the variable automaticly <strong>resets</strong> to its original state.</p>

<p>How can I save the value of that variable in Javascript?I am using the <strong>jQuery</strong> library.</p>

<p>EDIT:This is the code I've writen using sessionStorage but it still dosen't work when I move to next page the value is reseted.</p>

<p>How can I wright this code so that i dosen't reset on each page change.All pages on my website use the same script.</p>

<pre><code>$(document).ready(function(){
         var total = 0;



            $('input.check').click(function(){
                if($(this).attr('checked')){
                    var check = parseInt($(this).parent().children('span').text().substr(1 , 3));
                    total+=check;
                    sessionStorage.var_name=0 + total;
                    alert(sessionStorage.var_name);

                }else{
                    var uncheck = parseInt($(this).parent().children('span').text().substr(1 , 3));
                    total-=uncheck;


                }
            })
</code></pre>
