short answer: DIVs can't receive focus()

On Mar 5, 6:40 pm, "homien...@gmail.com" <homien...@gmail.com> wrote:
> anyone?
>
> On Mar 5, 3:27 pm, "homien...@gmail.com" <homien...@gmail.com> wrote:
>
> > I have a div with a textbod inside of it. When both of these lose
> > focus, so the focus is not on either of them, then I want the div to
> > move. How would I write the code that if both of these lose focus,
> > THEN do whatever i want.
> > I just want to know how to have 2 selectors, and when both of them
> > lose focus, then do something.
>
> > Ami gave me this code but it doesn't seem to be working, can someone
> > help me out?
>
> > var divFocus=false,textareaFocus=false
> > $('div').focus(function () {divFocus=true}).blur(function()
> > {divFocus=false;doSomething()};
> > $('textarea').focus(function () {textareafocus=true}).blur(function()
> > {textareaFocus=false;doSomething()}
>
> > function doSomthing()
> > {
> > if (!divFocus && !textAreaFocus) alert('There is no focus on the
> > div&textarea')
>
> > }

Reply via email to