You can do it as follow:
catch the
escape
character on its key in event$(document).keypress(function(event){ alert(String.fromCharCode(event.which)); })
append the \ with
escape
characters to the user input.//Append text to input element function jQ_append(id_of_input, text){ if(text=='`'){ text='\`'; } $(id_of_input).val($(id_of_input).val() + text); }