0
I'm trying to make a button that changes an already written text in a webpage. Changing the font style, weight etc
Javascript html css
2 ответов
+ 1
Set an on click to the button and change all you want to in the click function
0
1. get your button element by id from html to your javascript, add an event listener with click event.
2. create a css class with your styles after click.
3. inside the callback in your event listener get the element that needs to change styles.
4. append the class name into the element that contains the text, use classList.add(‘.class’)