How to display error without alert box using javascript ?
Errors in JavaScript can be displayed without the use of alert boxes but using the alert box is the traditional way to do that. We can show errors with two methods without using the alert box.
1. Code:
Demo
Soltuts.com
Display error without alert box
2. Syntax:
By using textContent property. The textContent is basically used to change the content of any node dynamically. With the help of this property we can display any content and draw user’s attention just like alert boxes
Syntax: node.textContent = "Some error message" node.style.color = "red";
Example:
Run the above program to see the example