I have the following scenario: A input text
that comes with a certain value / text from the DB but that the user should not be able to edit. To do this, pressing a key on input
will delete that same character.
What I'm doing is: I use keydown
on input
, I pass the key event:
<input type="text" value="Texto da base de dados" keydown="apagaLetra(this)" />
Now in the js
function, I'm not sure what to do. I can see which key is pressed with e.which
, now delete is that I am not seeing how it is done.
The end result is: When the user presses a key in the input, from the JS I do backspace