v1
11/3/2020 by ars81 -00
disable setup HTML
Setup HTML
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
</head>
<body>

<div id="testDiv" class="container text-center text-md-left shadow rounded">
  Test div
</div>

</body>
</html>
disable setup JavaScript
Setup JavaScript

$.fn.removeClassLikeA = function(name) {
    return this.removeClass(function(index, css) {
        return (css.match(new RegExp('\\b(' + name + '\\S*)\\b', 'g')) || []).join(' ');
    });
};

$.fn.removeClassLikeB = function(name) {
    var classes = this.attr('class');
    if (classes) {
        classes = classes.replace(new RegExp('\\b' + name + '\\S*\\s?', 'g'), '').trim();
        classes ? this.attr('class', classes) : this.removeAttr('class');
    }
    return this;
};
delete caserun single casemove downdrag and drop case


ready



$('#testDiv').clone().removeClassLikeA('text-');
delete caserun single casemove updrag and drop case


ready



$('#testDiv').clone().removeClassLikeB('text-');
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN