You can have as many document ready checks as you want. I'd like to
keep things organized by only having one though.
As for the checkbox being selected by default when the page loads, you
can do either of two things:
1) run the function on page load that checks for the checkbox and do
any changes
2) or run a code to that unchecks the checkbox on page load so that
it's always unchecked on page load.

On Aug 7, 5:18 am, Samuurai <djbe...@gmail.com> wrote:
> Sorry Johnathan, I sent a seperate reply, but it never came through.
>
> Thanks for your input.. My question about it was... is it bad practice
> to have more than one $(document.ready(function(){}) scripts, or can I
> have multiple?
>
> Cheers,
>
> Beren
>
> On Aug 7, 1:43 pm, "Jonathan Vanherpe (T & T NV)" <jonat...@tnt.be>
> wrote:
>
> > You'll have to run the whole function block within
> > $("#show_resolve").click() on load (ie. put it somewhere in
> > $(document).ready(function(){}).
>
> > Make it a seperate function so you can avoid copy/pasting the whole thing
>
> > Jonathan
>
> > Samuurai wrote:
> > > Hi,
>
> > > This is my first little foray into JQuery, so far i'm impressed,
> > > having had very little JS experience, I was able to create the result
> > > I wanted very qucikly and easily!
>
> > > However, I'm having one little niggle...
>
> > > Here's my code:
> > > [code]
> > >                    $(document).ready(function(){
> > >                                    
> > > $(".submit_problem_form_right").css("visibility","hidden");
> > >                                    
> > > $("#left_submit").css("visibility","visible");
> > >                                    $("#show_resolve").click(function () {
> > >                                    if ($("#show_resolve").is(":checked"))
> > >                                    {
> > >                                            
> > > $(".submit_problem_form_right").css("visibility","visible");
> > >                                            
> > > $("#left_submit").css("visibility","hidden");
> > >                                    }
> > >                                    else
> > >                                    {
> > >                                            
> > > $(".submit_problem_form_right").css("visibility","hidden");
> > >                                            
> > > $("#left_submit").css("visibility","visible");
> > >                                    }
> > >                            });
> > >                    });
> > > [/code]
>
> > > This works fine.. ticking the checkbox shows and hides the div.
> > > However, if I check the checkbox and refresh the page, the checkbox
> > > remains ticked, but the div is hidden.
>
> > > Any ideas how I can make it work reliably?
>
> > --
> > Jonathan Vanherpe - Tallieu & Tallieu NV - jonat...@tnt.be
>
>

Reply via email to