JavaScript Error message Property - Javascript DOM

Javascript examples for DOM:Error


The message property sets or gets an error message.

Return Value

A String, representing a description of an error

The following code shows how to return an error message

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<p id="demo"></p>

try {//from   w  w w  .ja  v  a  2  s.c om
catch(err) {
    document.getElementById("demo").innerHTML = err.message;


Related Tutorials