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') } Hope it's help you. Aminadav On Mar 2, 4:38 am, "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. > i'm probably missing the obvious... it's been a long day. > thanks!