Onblur vs onclick timing

There is an element textareathat converts to divwhen an event onbluroccurs on the same textarea. There is also buttonwhich property is onclickset to function f.

If you write to textarea, and then click on button, the fevent handler starts and also starts onblur. Are there some order rules in this case, or can two handler functions be launched in random order?

+4
source share
2 answers

Here I created jsfiddle: http://jsfiddle.net/z5SEp/

Events for the latest Chrome look like this:

mousedown
blur
mouseup
click 

, , , mousedown, . Mousedown , - .

1. mousedown 2. mouseup 3. . mousedown, mouseup.


,

, : $('button').trigger('click');, , .

+5

, , . , , textarea . , , .

0

Source: https://habr.com/ru/post/1535058/


All Articles