Question: Hello, I need help styling my javascript error messages in strictly javascript . My professor does not want me to mix HTML in my js

Hello, I need help styling my javascript error messages in strictly javascript. My professor does not want me to mix HTML in my js code. How can I style my error messages with strictly javascript?

heres my current code that is breaking the division of concerns by using html in my js code:

JAVASCRIPT CODE:

if (title === "") { errorMessage += "

Title field cannot be empty.
"; }

CSS CODE:

.error-message { color: red; }

thank you!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!