overleaf/services/web/public/coffee/keys/BackspaceHighjack.coffee

9 lines
229 B
CoffeeScript
Raw Normal View History

2014-02-12 10:23:40 +00:00
define [
], () ->
rx = /INPUT|SELECT|TEXTAREA/i
$(document).bind "keydown keypress", (e)->
if e.which == 8
# 8 == backspace
if !rx.test(e.target.tagName) || e.target.disabled || e.target.readOnly
e.preventDefault()