JSFiddle - React, Tailwind, and code Playground

by ExceptionLimeCat

HTML

<button class="vacation-2">Go</button>

JavaScript

$('button').on('click', function(){
    
    var classList = $(this).attr('class');
    var patt = /vacation-([0-9]{1,})/;
    console.log(classList + ' | Match: ' + classList.match(patt));
    var vacation = classList.replace(patt, function(a,b){
        return b;
    });
    $(this).html(vacation);
});