Browse Source

bring-it-to-life: add code examples to get an element by id in js and set its style properties

content-update
Marie Malarme 3 years ago committed by Clément
parent
commit
fe84fbd4ce
  1. 9
      subjects/bring-it-to-life/README.md

9
subjects/bring-it-to-life/README.md

@ -19,6 +19,15 @@ In the JS file, add the freshly-created class `eye-closed` to the [`classList`](
Reload the page - it's alive! Your JS brain has control and orders your HTML/CSS body to close one eye.
### Code examples
Get a HTML element by its `id` & set its inline style:
```js
const myDiv = document.getElementById('my-div')
myDiv.style.color = 'green'
```
### Expected output
This is what you should see in the browser:

Loading…
Cancel
Save