JSFiddle - React, Tailwind, and code Playground

HTML

<button id="button">Get Text</button>

JavaScript

window.onload=function()
{
    var el=document.getElementById('button');
    el.onclick=function(){
        var my_text=prompt('Enter text here');
        if(my_text) alert(my_text);
    }
}