First Draft
First Draft of the Example Files
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Events: keypress</title>
|
||||
<script src='jquery-3.5.1.min.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Press some keys</h2>
|
||||
<div id='result'></div>
|
||||
<script>
|
||||
$(document).keypress(function(event)
|
||||
{
|
||||
key = String.fromCharCode(event.which)
|
||||
|
||||
if (key >= 'a' && key <= 'z' ||
|
||||
key >= 'A' && key <= 'Z' ||
|
||||
key >= '0' && key <= '9')
|
||||
{
|
||||
$('#result').html('You pressed: ' + key)
|
||||
event.preventDefault()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user