JSFiddle - React, Tailwind, and code Playground

HTML

<h2>Variable Bar</h2>
<div style="width:400px;border:1px solid;">
<div id="bar2">&nbsp;</div>
</div>
<input type="button" value="Add 10%" id="add10" />

CSS

#bar2 {
 height:20px;
 background:red;
 width:0%;
}

JavaScript

var progress=10;

$( function()
  {

          $('#add10').click( function()
          {
             progress+=10;
             if (progress>100) progress=100;             
             $('#bar2').css('width', progress + '%' );
          });
        
  });