Created
April 13, 2016 16:20
-
-
Save mcleary/ca6bd4597b48e25061022c01667fe295 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Teste de Input</title> | |
</head> | |
<body> | |
<input id="textinput" type="text"></input> | |
<input id="textoutput" type"text"></input> | |
</body> | |
<script> | |
input = document.getElementById("textinput"); | |
output = document.getElementById("textoutput"); | |
input.addEventListener("keydown", function(event) { | |
possible_inputs = ['-']; | |
if(event.shiftKey) { | |
return; | |
} | |
// '-' == 189 | |
// Ver tabela ASCII | |
if(event.keyCode == 189) { | |
output.value += '-'; | |
} | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment