Hello,
I have forms with div to organize input.
I want when i change input focus from one div to an other -> trigger event lostFocus.
My soluce :
mousedown on document :
- checkDivLostFocus
- save current click (x,y)
focus input/textarea/select (to fix tab key)
- checkDivLostFocus
- save current click (x,y)
checkDivLostFocus
- get old click
- for all div a with "lostFocus" class
check if old click is on the div (x,y) and new click out of the div (x,y)
if true keep the div
- sort divs whith width and height
- trigger lostFocus from the smallest to the biggest
For fix propagation problème, give "return false" to all div with the class "lostFocus" for lostFocus event
How to use :
- give the "lostFocus" class to a div with for example id="myDiv"
and in js :
$("#myDiv").on("loseFocus",function(){
console.log("#Mydiv lost focus");
});
What do you think about this soluce ?
Sorry for my english, I'm French ;)