Ah, I think I see the issue. Am I right in assuming that you don't want to simulate the backspace, but detect it?
Also, how are you keeping track of the replacement? It seems to me that you could do yourself a big favor and make what the user enters not what you show the user, so when they delete a smiley, you can just remove the whole thing? On Jan 8, 10:32 am, RSol <viacheslav.rud...@gmail.com> wrote: > I write WYSWYG editor. > Need to replace ':)' to image on the fly. > I use execCommand('InsertImage',false,img) in 'keyup' evens, but I > need to remove ':)', otherwise execCommand put image each time I press > the key. > > On 8 янв, 17:20, Eric Garside <gars...@gmail.com> wrote: > > > What are you trying to achieve? That bit of looks... bad at best for > > achieving something. What's the goal? > > > On Jan 8, 5:57 am, RSol <viacheslav.rud...@gmail.com> wrote: > > > > I read that I can simulate keypress with code: > > > > $('#editor').trigger("keypress", [],null,{which: > > > 8,pageX:e.pageX,pageY:e.pageY}); > > > > This code dont work. > > > > Please help me solve this.