I agree with Flesler. jQuery is designed to abstract things such as
this.
I actually do have a plugin that allows a syntax easier than this.
It's name is Keys and you can find it on the jQuery plugin site or at
http://shugartweb.com/jquery/keys.
It allows syntax such as $('input').keys('tab, space + [109]', function
() {
// do something....
});
The above would fire the callback whenever 'tab', or 'space' + key 109
is pressed on any input field.
I really would like some feedback on this plugin and would love if
someone wanted to collaborate on further releases. I wrote it awhile
ago so I am intending to do a code overhaul on it.
Cheers,
Trey
On Jan 31, 11:06 pm, Ariel Flesler <[email protected]> wrote:
> The idea is nice, but I think is quite out of the core's scope.
> There're already +1 hotkey plugins and they work nicely.
>
> This syntax could be proposed to these plugins' owners.
>
> --
> Ariel Fleslerhttp://flesler.blogspot.com
>
> On 30 ene, 03:24, Yehuda Katz <[email protected]> wrote:
>
> > I brought this up a while back and I think it was well-received. I'd like to
> > get some feedback on this proposal again before putting any work into it.
> > The basic idea is:
>
> > $("p").bind("keydown[keyCode=119]", function() {})
>
> > It's basically a shortcut for:
>
> > $("p").bind("keydown", function(e) { if(e.keyCode == 119) { } })
>
> > I'd imagine it'd work with other operators (>, <, !=), and use literals
> > (true, 119, 'string'). I'm not 100% sure yet how to implement it without
> > eval, but it should be doable (would probably require a simple literal
> > parser, but that's fine with me).
>
> > --
> > Yehuda Katz
> > Developer | Engine Yard
> > (ph) 718.877.1325
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---