JSFiddle - React, Tailwind, and code Playground
HTML
<input id="myInput" type="number" min="1" max="*jsvariable*"/>
<input type="button" onClick="changeVar()" value="change">
JavaScript
var variable = 10;
var input = document.getElementById("myInput");
function changeVar(){
variable += 1;
input.setAttribute("max",variable); // set a new value;
}