HMTL Javascript question.. focus/blur

lozina

Lifer
Sep 10, 2001
11,711
8
81
I have an editable div which acts as a WYSIWYG editor on the page. There is also a toolbar on the page which hold the buttons for bold/italic/etc...

Is there any way I could put a onblur event on my div where I could determine that the element getting focus is in the toolbar ? Basically I want to do something when the div loses focus BUT ONLY if the user is clicking something on the toolbar.

And because of this particular layout, I absolutely cannot make the div and toolbar part of the same parent element - at least not when they are by themselves. There would have to be other elements included which I'd want something special to happen when they gain focus after the div...
 

lozina

Lifer
Sep 10, 2001
11,711
8
81
I guess one thing I can do is keep track of the last focused div so when a user clicks one of those buttons it knows what to apply the style to?