JSFiddle - React, Tailwind, and code Playground
by NunoMira
HTML
<label> Nome para a Maria:</label>
<input type="text" id="maria" />
JavaScript
//Keydown e keypress
$(document).ready( function()
{
$('#maria').bind("keypress keydown", function(e)
{
if (e.which == 32)
alert('space');
if (e.which == 8)
alert('back space');
//para que se tivermos fora dum input ele nao andar com o browser para trás
e.preventDefault();
}
});
});