[jQuery] Firefox caching form data on soft refresh
Hi everyone,
First I would like to say this is my second day playing with jQuery
and I can tell I am going to be hooked on it. Very cool stuff, and not
to mention how well it helps downgrade for non-js browser. Very Cool!
Now, on to my question:
Right now I have a form where a few div's are open or closed based on
the selections of checkboxes.
One thing I noticed in firefox during a soft refresh, it still retains
the checkboxed values so what this means that is on a soft refresh,
checkboxes which should open the div's are checked, yet the div is
closed.
Now during a hard refresh (Hold shift down + refresh; it forces
browser to recompile cache) of which will forget what was checked.
My question is, how do you guys handle this? Is there a way I can call
all of my actions on page load to set the status of the divs based on
what is checked / not checked?
I tried binding my handlers to the load , but it failed to produce any
results.
// also tried $(document).bind("ready load",
$(document).ready(
function()
{
$("#hidden_agreements").hide();
$("#submit").hide();
// also tried $("#accept_tos").bind("change click load",
$("#accept_tos").bind("change click",
function()
{
if ($("#accept_tos").is(":checked"))
{
$("#hidden_agreements").fadeIn("medium");
}
else
{
$("#submit").fadeOut("fast");
$("#hidden_agreements").fadeOut("fast");
$("#original_designer").attr('checked', false);
$("#original").attr('checked', false);
$("#not_selling_elsewhere").attr('checked', false);
}
}
)
var agreements = function()
{
if ($("#original_designer").is(":checked") && $
("#original").is(":checked") && $
("#not_selling_elsewhere").is(":checked"))
{
$("#submit").fadeIn("fast");
}
else
{
$("#submit").fadeOut("fast");
}
}
$("#original_designer").bind("change click", agreements)
$("#original").bind("change click", agreements)
$("#not_selling_elsewhere").bind("change click", agreements)
}
);