Setting Options in addEventListener

·

1 min read

We can set options about addEventListener such as 'once', 'capture' or 'passive'.

I'm not going to write what the functions of the options are, but write how to apply them.

To apply them, we have to write something as the third argument.

Way 1: an Object

Below is the example.

Please be careful that IE does not support the way.

Way 2: a Boolean

If we just write a boolean, that is about 'capture' option.

Below in the example.

Luckily, IE supports the way.