Skip to content

Instantly share code, notes, and snippets.

@grippado
Created July 24, 2015 18:10
Show Gist options
  • Save grippado/f5e4184843cc848e8249 to your computer and use it in GitHub Desktop.
Save grippado/f5e4184843cc848e8249 to your computer and use it in GitHub Desktop.
<form id="palinChecker">
<input id="input" />
</form>
var palindromo = function (string) {
if (string == string.split('').reverse().join('')) {
alert(string + ' é palindromo!');
}
else {
alert(string + ' não é palindromo!');
}
}
document.getElementById('palinChecker').onsubmit = function() {
palindromo(document.getElementById('input').value);
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment