Data Attributes
Data Attributes
data-* attributes let HTML carry small pieces of custom state. In JavaScript, those values are available through the element's dataset object.
This is useful when markup already knows something that your script needs, such as a plan, ID, state, or tracking key. The job is to read the DOM state and write a second attribute that improves the interface.
Your task: Read the selected plan's data-plan value and use it to set the button's aria-label to Choose <plan> plan.
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.
Data Attributes
data-* attributes let HTML carry small pieces of custom state. In JavaScript, those values are available through the element's dataset object.
This is useful when markup already knows something that your script needs, such as a plan, ID, state, or tracking key. The job is to read the DOM state and write a second attribute that improves the interface.
Your task: Read the selected plan's data-plan value and use it to set the button's aria-label to Choose <plan> plan.