I’m using jQuery and have retrieved a string containing all the classes of an element like this:
var classes = $('[class^="menu-icon-"]').attr('class');
The string prints something like this: “foo menu-icon-icon-name bar”
How can find out what the “icon-name” part in the string is, whatever it may be?
It will always be with a class formatted as “menu-icon-{icon-name-here}” among whatever other classes the element may contain.
This works in all cases-