Bold and Unbold | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Bold and Unbold

Okay so how do i make it so when my button is clicked it says unbold i tried in javascript using elementbyid and making the string to “Unbold” but it didnt work any help? https://code.sololearn.com/WcheSYQXQntj/?ref=app

26th Mar 2022, 5:21 PM
Junior
Junior - avatar
5 Answers
+ 1
+ In HTML: <button type="button" onclick="text.classList.toggle('bold');">Bold</button> <button type="button" onclick="text.classList.toggle('upperCase');">Upper/Lower</button> <input type="text" id="text"> <!-- </p> without a pairing <p> ... </p>--> + In CSS: .bold { font-weight: bold; } .upperCase { text-transform: uppercase; } Delete all code in JS tab.
27th Mar 2022, 2:45 AM
Ipang
0
It doesnt work
26th Mar 2022, 5:42 PM
Junior
Junior - avatar
0
Okay so where is the syntax error? https://code.sololearn.com/WGZes8iMS9TX/?ref=app
27th Mar 2022, 12:18 AM
Junior
Junior - avatar
0
Okay so Ipang why is my charcter count not working? https://code.sololearn.com/WfVYcf88U2b5/?ref=app
27th Mar 2022, 3:26 AM
Junior
Junior - avatar
0
Get the input 'value' attribute. let txt = document.getElementById("text").value;
27th Mar 2022, 3:53 AM
Ipang