badwolfff
asked on
Is is possible to condense this repeating jQuery?
I have a similar type of code that I need to repeat in jQuery about 10 times. How do I condense it?
(I've just shown you the first two repetitions):
thanks
(I've just shown you the first two repetitions):
$('[class^="cmsms-icon-"]').removeClass(function(i, cls) {
var target = cls.match(/(^|\s)cmsms-icon-\S+/g) || [];
$('a', this).addClass(target[0]);
return target[0];
});
$('[class^="mfcustom-icon-"]').removeClass(function(i, cls) {
var target = cls.match(/(^|\s)mfcustom-icon-\S+/g) || [];
$('a', this).addClass(target[0]);
return target[0];
});
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.