JSFiddle - React, Tailwind, and code Playground

by Kevin Faulhaber

HTML

<input type="text" value="" placeholder="lastname" id="ln" />
<button id="but">Prompt me!</button>

JavaScript

var ln = document.getElementById('ln'), but = document.getElementById('but');

but.onclick = function(){
    if(ln.value.length == 0){
        ln.value = prompt('last name please?');
    }else{
            //What do you want me to do here?
    }
};