JSFiddle - React, Tailwind, and code Playground

HTML

<div class="o-test n-test test">This is a test</div>
<br />

<button>Click to remove class</button>

CSS

.o-test {color:blue}
.n-test {color:red}

JavaScript

$.fn.removeClassStartsWith = function(param) {
    return this.each(function() {
        var classes = this.className.split(/\s+/g),
            newclasses = [];
        
        $.each(classes, function(_,klass) {
            if ( $.trim(klass).indexOf(param) !== 0 ) newclasses.push($.trim(klass));
        });
        
        this.className = newclasses.join(' ');
    });
}

$('button').on('click', function() {
    $('div').removeClassStartsWith('n-')
});