Prev Demo
AngularJS
>
Key Events
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> </head> <body> <script> var app = angular.module("app", []); app.controller("KeyController", function ($scope) { $scope.KeyDown = function () { $scope.keydown = " Key down executes " + new Date().getTime(); } $scope.KeyPress = function () { $scope.keypress = " Key press executes " + new Date().getTime(); } $scope.KeyUp = function () { $scope.keyup = " Key up executes " + new Date().getTime(); } }); </script> <h2>Key Events</h2> <div ng-app="app" ng-controller="KeyController"> <p>Try writing something in the textbox below</p> <input type="text" ng-keydown="KeyDown()" ng-keypress="KeyPress()" ng-keyup="KeyUp()" /> <hr /> <p>Key down - {{ keydown }}</p> <p>Key press - {{ keypress }}</p> <p>Key up - {{ keyup }}</p> </div> </body> </html>
Note: We DO NOT save your trial code in our database.
Output