What I wanted was to get the name of the person shown with the alert but I'm not able to
My html code
var nome = document.getElementById('id1').value;
function clique(){
alert(nome);
}
<input id="id1" type="text"/>
<button onclick="clique">Clique aqui</button>