Input readonly backspace issue

You could always just keep the input field readonly disallow input altogether.

<div class="div1">
    <label class="div1" for="inputfor">cash:</label>
    <input type="text" id="cashinput" onkeydown="return false;" readonly="readonly"/>
</div>​​​​​​​​​​​​​​​

I know that this question was asked 2 years back. Since I have a solution that worked for me, I am tempted to share it with everyone.

The fix is quite simple:

<input type="text" onkeydown="event.preventDefault()" readonly="readonly"/>

The event.preventDefault() will stop the backspace from navigating away from the page and you can also select and copy the text.

Thanks.