The classList property is not supported in Internet Explorer 9 and earlier.
In this example, we check if the browser supports the classList.contains() method. If not, the regular expression works as a fallback to achieve the same result (for IE 9 and earlier).
Click the button to find out if the DIV element has a "mystyle" class.