@gauravsingh1281
Submitted
Have a look over my code and give a suggestions on how i can improve my coding skills.
@mrxshinji
@gauravsingh1281
Submitted
Have a look over my code and give a suggestions on how i can improve my coding skills.
@mrxshinji
Posted
For your alert code, it is better not to touch innerText with js whenever possible in my opinion. Its like all the changes in structure should keep in html, script changes in js, and stylechanges in css .
I would use css {display: none} and {display: block} to show the text by adding active class instead.
<p id="alert">"Please select a number"</p>
#alert{
display: none;
}
#alert.active {
display: block {
}
document.querySelector("#alert").classList.add("active")
This should be the way to write this....
Marked as helpful