Hướng dẫn thử thách
1 / 10
Handle Click Events with JavaScript using the onclick property
You want your code to execute only once your page has finished loading. For that purpose, you can attach a JavaScript event to the document called `DOMContentLoaded`. Here's the code that does this:
```js
document.addEventListener('DOMContentLoaded', function () {});
```
You can implement event handlers that go inside of the `DOMContentLoaded` function. You can implement an `onclick` event handler which triggers when the user clicks on the `#getMessage` element, by adding the following code:
```js
document.getElementById('getMessage').onclick = function () {};
```
# --instructions--
Add a click event handler inside of the `DOMContentLoaded` function for the element with id of `getMessage`.
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.sh
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵