Basic Level:
- Create a button that, when clicked, changes the text inside a
<p>
tag using innerText
.
- Write a function that, when clicking a button, changes the text inside a
<div>
using innerHTML
.
- Create a button that, when clicked, updates a
<p>
element’s textContent
with a new message.
- Add a button that, when clicked, sets an attribute
src
to an <img>
tag to change the image.
- Create a button that toggles the
hidden
attribute on a paragraph using setAttribute
.
Intermediate Level:
- Create a button that, when clicked, changes the background color of a
<div>
using style.backgroundColor
.
- Write a function that dynamically adds and removes a CSS class from a
<p>
element using classList.toggle()
.
- Create a list with three items and a button that, when clicked, adds a new item dynamically using
innerHTML
.
- Create a button that removes a CSS class from an element using
classList.remove()
.
- Write a function that changes the
href
attribute of an <a>
tag using setAttribute
when a button is clicked.
Advanced Level:
- Create a button that, when clicked, cycles through three different background colors for a
<div>
.
- Build a simple counter app using
innerText
, onclick
, and a button to increase the count.
- Make a toggle button that switches between "Show" and "Hide" for a paragraph by updating
innerText
and changing display
style.