minor
This commit is contained in:
parent
de725bd171
commit
217eb0e5fa
2 changed files with 6 additions and 4 deletions
|
@ -5,7 +5,7 @@ Let's start with an example.
|
||||||
This handler is assigned to `<div>`, but also runs if you click any nested tag like `<em>` or `<code>`:
|
This handler is assigned to `<div>`, but also runs if you click any nested tag like `<em>` or `<code>`:
|
||||||
|
|
||||||
```html autorun height=60
|
```html autorun height=60
|
||||||
<div onclick="alert('The handler !')">
|
<div onclick="alert('The handler!')">
|
||||||
<em>If you click on <code>EM</code>, the handler on <code>DIV</code> runs.</em>
|
<em>If you click on <code>EM</code>, the handler on <code>DIV</code> runs.</em>
|
||||||
</div>
|
</div>
|
||||||
```
|
```
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
form.onclick = function(event) {
|
form.onclick = function(event) {
|
||||||
event.target.style.backgroundColor = 'yellow';
|
event.target.style.backgroundColor = 'yellow';
|
||||||
|
|
||||||
alert("target = " + event.target.tagName + ", this=" + this.tagName);
|
// chrome needs some time to paint yellow
|
||||||
|
setTimeout(() => {
|
||||||
event.target.style.backgroundColor = '';
|
alert("target = " + event.target.tagName + ", this=" + this.tagName);
|
||||||
|
event.target.style.backgroundColor = ''
|
||||||
|
}, 0);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue