JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" class="button1" value="set number">
<input type="button" class="button2" value="get number">

JavaScript

jQuery('.button1').on('click',function (){
    var num = Math.random();
    jQuery('.button2').on('click',function (){
 
            alert(num.lenght);
            
        
    
    });
});