Element.className does not respect user defined Class Name


(Mark Hunte) #1

Hi ,

If I have named an element class name in the inspector, for example ** spaceButton**

And then try and get the class name of the element that triggered a hype function using:

element.className

the return will be HYPE_element spaceButton

Which means I have to keep using :
var theClassName = element.className.split("HYPE_element ")[1];

I know I could use a id which works as expected. But there I am finding issues with symbols and ids.
See this post :



Is there any way to stop hype adding the extra class name…


(Greg) #3

That is a handy little piece of code, thanks Mark.