remove prefixed class

$.fn.removePrefixedClass = function(prefix) { var classNames = $(this).attr('class'), newClassNames = [], className, i; classNames = (classNames !== undefined) ? classNames.split(' ') : ''; for (i = 0; i < classNames.length; i++) { className = classNames[i]; if (className.indexOf(prefix) !== 0) { newClassNames.push(className); continue; } } $(this).attr('class', newClassNames.join(' ')); };

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.