mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
fix: docment -> document
This commit is contained in:
@@ -111,14 +111,14 @@ window.onclick = function() {
|
|||||||
In our example we want to trigger a function based on the click of a button. To do this, we first need to get a reference to the button. We can use `querySelector` to get that reference. And then we can set its `onclick` value just like above.
|
In our example we want to trigger a function based on the click of a button. To do this, we first need to get a reference to the button. We can use `querySelector` to get that reference. And then we can set its `onclick` value just like above.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const button = docment.querySelector('.submit');
|
const button = document.querySelector('.submit');
|
||||||
button.onclick = displayMatches();
|
button.onclick = displayMatches();
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also combine these together like this:
|
You can also combine these together like this:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
docment.querySelector('.submit').onclick = displayMatches();
|
document.querySelector('.submit').onclick = displayMatches();
|
||||||
```
|
```
|
||||||
|
|
||||||
Wire this up and see you function in action!
|
Wire this up and see you function in action!
|
||||||
|
|||||||
Reference in New Issue
Block a user