[jQuery] Re: Simulate BackSpace key

2009-01-21 Thread Rick Faircloth
Looks good RSol...now for image handling capability? :o) > -Original Message- > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > Behalf Of RSol > Sent: Wednesday, January 21, 2009 1:30 AM > To: jQuery (English) > Subject: [jQuery] Re: Simu

[jQuery] Re: Simulate BackSpace key

2009-01-20 Thread RSol
http://inf.in-desk.ru/ On 20 янв, 17:27, "Rick Faircloth" wrote: > I went to take a look at the demo, but all I got > was a page of code...is there a working demo online?

[jQuery] Re: Simulate BackSpace key

2009-01-20 Thread Rick Faircloth
> To: jQuery (English) > Subject: [jQuery] Re: Simulate BackSpace key > > > Thanks to all! > > I do my WYSWYG editor as jQuery plugin: > > http://plugins.jquery.com/project/RSEditor > > Please see and say what you think about it.

[jQuery] Re: Simulate BackSpace key

2009-01-20 Thread RSol
Thanks to all! I do my WYSWYG editor as jQuery plugin: http://plugins.jquery.com/project/RSEditor Please see and say what you think about it.

[jQuery] Re: Simulate BackSpace key

2009-01-12 Thread RSol
What do movePrev() and .moveNext() function? I know'n that functions in jQuery. On 12 янв, 09:48, ggerri wrote: > Hi > > I've done something similar with the Tab. Maybe that helps. You'll > need the FIELDS Plugin for that: > > $("#PG1_L02-4-5") >                 .bind('keydown',function(e) { >  

[jQuery] Re: Simulate BackSpace key

2009-01-12 Thread RSol
Thank to all! I do it! function setCursorPosition(textArea, selOffset) { if (document.selection) { // IE, Opera var sel = document.selection.createRange(); sel.collapse(true); sel.moveStart('character', selOffset); textArea.focus(); sel.select();

[jQuery] Re: Simulate BackSpace key

2009-01-11 Thread ggerri
Hi I've done something similar with the Tab. Maybe that helps. You'll need the FIELDS Plugin for that: $("#PG1_L02-4-5") .bind('keydown',function(e) { switch(e.keyCode) { case 9: // tab i

[jQuery] Re: Simulate BackSpace key

2009-01-09 Thread jQuery Lover
You can't trigger but can achieve the same effect :) An you will definitely deal with Ranges to make your code cross browser :) jQuery HowTo Resource - http://jquery-howto.blogspot.com On Fri, Jan 9, 2009 at 7:43 PM, Ricardo Tomasi wrote: > > You can't actually trigger a keypress, only it'

[jQuery] Re: Simulate BackSpace key

2009-01-09 Thread Ricardo Tomasi
You can't actually trigger a keypress, only it's event listeners. I think you'll have to deal with "ranges": https://developer.mozilla.org/En/DOM/Range On Jan 9, 4:03 am, RSol wrote: > To replace ':)' to image I see 2 variants: > When I detect ':)' I: > 1. Emulate two BackSpace and execCommand(

[jQuery] Re: Simulate BackSpace key

2009-01-09 Thread jQuery Lover
There is a nice article (http://the-stickman.com/web-development/javascript/finding-selection-cursor-position-in-a-textarea-in-internet-explorer/) I found comments particularly useful. jQuery HowTo Resource - http://jquery-howto.blogspot.com 2009/1/9 RSol : > > I write WYSWYG editor and use

[jQuery] Re: Simulate BackSpace key

2009-01-09 Thread RSol
I write WYSWYG editor and use to editing 'div' tag with .attr ('contentEditable','true') On 9 янв, 08:23, "jQuery Lover" wrote: > Here is how to simulate a backspace in javascript: > >   getElementById('yourTextBox').Select(TextBox1.SelectionStart - 1, 1) >   getElementById('yourTextBox').Se

[jQuery] Re: Simulate BackSpace key

2009-01-09 Thread RSol
In jQuery is: $('#editor')[0].Select($('#editor')[0].SelectionStart - 1, 1); $('#editor')[0].SelectedText = ''; I try in FF - this no work: Error: editor[0].Select is not a function On 9 янв, 08:23, "jQuery Lover" wrote: > Here is how to simulate a backspace in javascript: > >   getElementBy

[jQuery] Re: Simulate BackSpace key

2009-01-08 Thread jQuery Lover
Here is how to simulate a backspace in javascript: getElementById('yourTextBox').Select(TextBox1.SelectionStart - 1, 1) getElementById('yourTextBox').SelectedText = " jQuery HowTo Resource - http://jquery-howto.blogspot.com On Fri, Jan 9, 2009 at 11:03 AM, RSol wrote: > > To replace '

[jQuery] Re: Simulate BackSpace key

2009-01-08 Thread RSol
To replace ':)' to image I see 2 variants: When I detect ':)' I: 1. Emulate two BackSpace and execCommand('InsertImage',false,img) 2. Get all text from '#editor', then String.replace(/:\)/g,img), then put that in '#editor', then need moove cursor to the end of '#editor'. I dont know how to move cu

[jQuery] Re: Simulate BackSpace key

2009-01-08 Thread RSol
I try - this no work. :( On 8 янв, 14:19, "jQuery Lover" wrote: > As far as I can remember trigger function takes only two parameters. The > second parameter should be an array: > $('#editor').trigger("keypress", [null,{which: > 8,pageX:e.pageX,pageY:e.pageY}]); > > On Thu, Jan 8, 2009 at 3:57 P

[jQuery] Re: Simulate BackSpace key

2009-01-08 Thread jQuery Lover
As far as I can remember trigger function takes only two parameters. The second parameter should be an array: $('#editor').trigger("keypress", [null,{which: 8,pageX:e.pageX,pageY:e.pageY}]); On Thu, Jan 8, 2009 at 3:57 PM, RSol wrote: > > I read that I can simulate keypress with code: > > $('#

[jQuery] Re: Simulate BackSpace key

2009-01-08 Thread Eric Garside
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

[jQuery] Re: Simulate BackSpace key

2009-01-08 Thread RSol
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 wrote: > What are you trying to achieve? That bit of

[jQuery] Re: Simulate BackSpace key

2009-01-08 Thread Eric Garside
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 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 wo