using typescript I want to create a textbox whixh allows on numbers.
textbox-alpha.ts
import {bindable} from 'aurelia-framework';
export class textboxNumber {
@bindable public allownumber : number;
}
function onlynumber(allownumber) {
allownumber = (allownumber) ? allownumber : event;
var charCode = (allownumber.charCode) ? allownumber.charCode : ((allownumber.keyCode) ? allownumber.keyCode :
((allownumber.which) ? allownumber.which : 0));
if (charCode > 31 && (charCode < 65 || charCode > 90) &&
(charCode < 97 || charCode > 122)) {
return false;
}
return true;
}
textbox-alpha.html
<input type="text" onkeypress="onlynumber(allownumber)" required />