Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
100
rated 0 times [  104] [ 4]  / answers: 1 / hits: 31141  / 14 Years ago, thu, july 8, 2010, 12:00:00

What's the fastest way possible to get a string like fade from the classes in the element below?



<div class=MyElement fx-fade> ... </div>

More From » jquery

 Answers
6
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];
}
}

[#96299] Monday, July 5, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aileenreynap

Total Points: 140
Total Questions: 106
Total Answers: 99

Location: Andorra
Member since Sun, Oct 18, 2020
4 Years ago
;