Open In App
Related Articles

HTML DOMException message Property

Improve Article
Save Article
Like Article

The DOMException message property returns a DOMString representing a message or description associated with the given error. This is a read-only property.



Return Value: This property returns a DOMString associated with an error.

Example: This example illustrates the use of DOMException message property.


<!DOCTYPE html>
        Click below to get
        the exception message
    <button onclick="get()">Click</button>
    <p class="p">Error Message is : </p>
        function get() {
            try {
                // INVALID_CHARACTER_ERR
                var elem = document
            catch (e) {
                    .textContent += e.message;


Before Clicking the Button:

After Clicking the Button:

Supported Browsers: 

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Internet Explorer 9
  • Safari 1
  • Opera 12.1
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 06 Jul, 2022
Like Article
Save Article
Similar Reads
Complete Tutorials