and....i have done this in Chrome using dispatchEvent with
initKeyboardEvent but i am unable to acheive the same in Mozilla's
equivalent (initKeyEvent)...or the simulate plugin.

On Jan 15, 3:13 pm, Leeoniya <leeon...@gmail.com> wrote:
> the focus works of course, but that's not what i am trying to do.
>
> i want to convert any keystroke of my choosing to behave like a tab.
> including shift+key. the browser already respects tabindex natively. i
> would like to avoid writing a bunch of code that tries to mimic that
> behavior (yes it can be done of course).
>
> i want to do $("#field").keydown(function(e){
>   if (e.keyCode == 107) {
>     if (!e.shiftKey)
>       // fire/simulate a tab press here
>     else
>       // fire/simulate shift+tab keys here
>     return false;
>   }
>   else
>     return true;
>
> });
>
> On Jan 15, 2:13 pm, Balázs Suhajda <suhaj...@gmail.com> wrote:
>
> > I've made a very simple example 
> > here:http://jsbin.com/etura(http://jsbin.com/etura/edit)
> > And seems to be fine. Could you share what you did?
>
> > On Fri, Jan 15, 2010 at 5:48 PM, Leeoniya <leeon...@gmail.com> wrote:
> > > tried it, this does not work.
>
> > > On Jan 15, 3:27 am, Balázs Suhajda <suhaj...@gmail.com> wrote:
> > >> To move the cursor, you have to set focus() on the element.
>
> > >> $("#fname").focus()
>
> > >> Of course to move to the next you might have to find it by it's tab index
>
> > >> $('input[tabindex=' + tabIndex + ']').focus();
>
> > >> On Thu, Jan 14, 2010 at 7:09 AM, Leeoniya <leeon...@gmail.com> wrote:
> > >> > not sure if i am doing this right, but it doesnt seem to work:
>
> > >> > $("#fname").simulate("keydown", {keyCode: 9});
>
> > >> > firebug shows the simulated keydown event identical to a real one in
> > >> > every way. but the cursor does not move to the next tabindex field. am
> > >> > i missing something?
>
> > >> > thanks,
> > >> > Leon
>
> > >> > --
> > >> > You received this message because you are subscribed to the Google 
> > >> > Groups "jQuery UI" group.
> > >> > To post to this group, send email to jquery...@googlegroups.com.
> > >> > To unsubscribe from this group, send email to 
> > >> > jquery-ui+unsubscr...@googlegroups.com.
> > >> > For more options, visit this group 
> > >> > athttp://groups.google.com/group/jquery-ui?hl=en.
>
> > >> --
> > >> Best regards,
> > >> Balázs Suhajda
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "jQuery UI" group.
> > > To post to this group, send email to jquery...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > jquery-ui+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/jquery-ui?hl=en.
>
> > --
> > Best regards,
> > Balázs Suhajda
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to jquery...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-ui+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to