Skip to content
Related Articles

Related Articles

HTML DOMException message Property

Improve Article
Save Article
Like Article
  • Last Updated : 18 Jul, 2020

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
  • Edge
  • Firefox
  • Safari
  • Opera
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!