DOM Manipulation

Create a Button

Create a Button

Created elements are regular DOM nodes. Before inserting them, you can set their text, classes, properties, and attributes.

This is safer than building a string when the new node needs meaningful attributes or future event listeners.

Your task: Create a button for exporting a report. Set its text to Export CSV, add the action-button class, set its type to button, set its aria-label to Export report as CSV, and append it to the actions area.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Create a Button

Created elements are regular DOM nodes. Before inserting them, you can set their text, classes, properties, and attributes.

This is safer than building a string when the new node needs meaningful attributes or future event listeners.

Your task: Create a button for exporting a report. Set its text to Export CSV, add the action-button class, set its type to button, set its aria-label to Export report as CSV, and append it to the actions area.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.