OnClick Jquery Event [closed]

0

I have two events ( OnClick y Focusout ). At the time of doing click in a input the focusout is waiting for this input to lose the focus and skip this same event, but if I do click in another element first jump the focusout , and after this I have to return to give click in the element to take the event onclick , is there any way to capture the two events at the same time? Greetings.

    
asked by Ruben 05.01.2018 в 08:33
source

1 answer

3

The javascript events can be called at 2 different points Capturing and Bubbling

More info: # event-flow

You can get to call the 2 javascript methods capturing the focusout with useCapture true and the onclick with useCapture false

Since jQuery you are always using useCapture false More info

To be able to perform both actions you must add the listener using javascript, where window is the element that the desired listener will have.

window.addEventListener('click',click(),false);
window.addEventListener('focusout',focusOut(),true);

addEventListener documentation

    
answered by 05.01.2018 / 13:19
source