i have made on textbox which is readonly. I want that when user press a number from keyboard then they are entered in textbox. I have applied onkeyup() event in the text box but it is not working.
<input type="text" id="screen" value="0" onkeyUp="myFunction(event)" readonly=true; >
function myFunction(event){
if ( event.keycode >= 48 && event.keycode <=57 ) {
//some code here
}
}
<input type="number">or<input pattern="\d+">?