jQuery - Get a element class based on a prefix

var classes = $('.MyElement').attr('class').split(' ');
for (var i = 0; i < classes.length; i++) {
  var matches = /^fx\-(.+)/.exec(classes[i]);
  if (matches != null) {
    var fxclass = matches[1];
  }
}

If you wanted to look for something that ended in 'fade' you would use:

$("*[class$='fade']")

And for elements with a class that started with 'fade' you would use:

$("*[class^='fade']")

And to get elements that contain 'fade' you would use (this would be quicker than going through the class names string)

$("*[class*='fade']")

The * gets all elements so you could replace this with the element you wanted.

If you want elements that has a classname that starts with fx- you would do:

var classname = "";
var elArray = $("*[class*='fx-']");
    
for (var a = 0; a < elArray.length; a++) {
   // fade
    classname = elArray[a].split("-")[1]; 
}

The array used in the for loop would have all the elements with the classnames like 'fx-'.

Rather than than the for loop checking the elements for the correct class name.

More information at jquery.com