$(document).bind('keydown', function(e) { if(e.keyCode == 8) { if(e.target.nodeName != 'INPUT' && e.target.nodeName != 'TEXTAREA') { e.stopPropagation(); e.preventDefault(); } } });