Ok, this is really really impressive. Every time that I have to deal
with text-field selection, I'm constantly banging my head against the
keyboard. This is a fantastic plugin to have on hand.
Some quick suggestions:
- When you replace a snippet, the cursor loses focus. It would be
fantastic if the new replaced snippet was selected too. Like so: foo
[bar] baz becomes: foo [zoo] baz (where [] is the selection)
- In the object that you return, including two other properties:
before (The text before the current selection) and after (the text
after the current selection)
- Make it so that you can bind a .selection() event (or some such) so
that you can have a method be called back every time the selection
changes, for example:
$(...).selection(function(e,s){
alert( s.text );
});
(This would only have to fire whenever the selection is complete)
This is a great plugin - I can't wait to use it! (Especially
considering that it works great in IE, Safari and Firefox!)
--John
On 12/16/06, Alex Brem <[EMAIL PROTECTED]> wrote:
> Hey jQuery lovers,
>
> I coded a small plugin to retrieve the caret position and the current
> selection index of input fields and textareas.
> Special treatment for such an simple thing is needed because MSIE
> doesn't support the easy DOM 3.0 methods (yes, this also applies to IE7
> *sigh*).
>
> So here's the plugin and a small test case:
>
> http://lab.0xab.cd/jquery/fieldselection/
>
> Please note that the plugin is a little rough and not very jQuerish at
> the moment - mainly because I don't know if this is useful for anyone
> else. If so, please gimme some feedback. Oh, and there's also a lack of
> documentation. :)
>
> Greets,
>
> Alex
>
> --
> http://www.kwick.de - KWICK! Community
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/