What James said. This is one of those edge-cases that can ruin your
day. If you look up the list of JavaScript reserved words, more than
likely you won't see 'closed' on it, because it's not really a
reserved word. It is however a property of the window object, and so
only has a getter, not a setter, from your code. That's why it works
inside the scope of your jQuery code, but fails when declared as a
global var.

On Apr 16, 2:18 pm, James <james.gp....@gmail.com> wrote:
> I haven't looked into it deeply yet, but try changing "closed" to
> another word, like "box_closed".
> closed is a reserved word in Javascript so I think that might be
> causing it.
>
> On Apr 16, 10:44 am, Rick <r...@marketingease.com> wrote:
>
> > It seems that having the var closed = false; outside of the function
> > kills the code..
>
> > Here is the page:http://client.vdhinc.com/cleardebtsolution/newsite/land/
>
> > The code not working is on the First Name field.. I also put an
> > example of the popup in the Last Name field so you can see what's
> > happening when it works..
>
> > On Apr 16, 1:29 pm, James <james.gp....@gmail.com> wrote:
>
> > > The code looks fine. When you say that "nothing works", does that mean
> > > even clicking the input field does not do the popup message?
> > > Have you tried putting an alert in the click callback to see if it
> > > executes?
>
> > > Also, instead of click, you might want to consider using 'focus'.
> > > Focus means the text cursor is in the field, whether the user clicked
> > > into it or used the tab button on the keyboard to navigate to it. It's
> > > a complement to blur, which is when the text cursor leaves the field.
>
> > > On Apr 16, 8:49 am, Rick <r...@marketingease.com> wrote:
>
> > > > I have this code:
>
> > > > var closed = false;
> > > > $(document).ready(function(){
> > > >         $('#FirstName').click(function(){
> > > >                 if (closed == false) {
> > > >                         $('#popUpMessage').fadeIn('fast');
> > > >                 }
> > > >         });
> > > >         $('#FirstName').blur(function(){
> > > >                 $('#popUpMessage').fadeOut('slow');
> > > >         })
> > > >         $('#popUpMessageClose').click(function(){
> > > >                 closed = true;
> > > >                 $('#popUpMessage').fadeOut('slow');
> > > >         })
>
> > > > });
>
> > > > As is, nothing works.. I have this on a field input like so...
>
> > > > <input type="text" name="FirstName" id="FirstName" size="20"
> > > > maxlength="128" />
>
> > > > when clicked it shows the hidden div "popUpMessage".. And on blur it
> > > > hides it.. Inside that "popUpMessage" div I placed a small div for a
> > > > close button named "popUpMessageClose".. What Im trying to do is hide
> > > > that popUpMessage div permanently if the close div is clicked.. Any
> > > > ideas where Im going wrong??

Reply via email to