Allow only backspace and delete in textbox javascript. KeyChar == (char)8); } .