Current code is <i class="arrow-right"></i>
I want to replace class in all <i>
elements having "arrow-right" with "new-arrows"
I tried it using JS.
function changeclass(newclass, elm) {
elm.attr('class', function (i, oldClasses) {
return newclass: oldClasses.replace(/\b(bg-[a-z]+)\b/i, return newclass;
});
}
$('i').each(function () {
changeclass('new-arrows', $(this));
});
You can use
toggleClass()
for this: