use Enter2Tab

http://docs.jquery.com/Plugins#Forms


Ariel Jakobovits wrote:
> 
> 
> that won't work. What if you have:
> 
> Campo 1: <input type="text" name="campo1" tabindex="1" /><br />
> Campo 3: <input type="text" name="campo1.5" /><br />
> Campo 2: <input type="text" name="campo2" tabindex="2" /><br />
> 
> why not:
> 
> $("[EMAIL PROTECTED]").bind("keydown",function(e){
>     if (e.keyCode == 13) {
>         tabIndex = parseFloat($(this).attr("tabindex")) + 1;
>         $("[EMAIL PROTECTED]" + tabIndex + "]").focus();
>         return false;
>     }
> });
> 
> and don't forget that you could make it more robust and check if the array
> returned is empty and wrap back to 1.
> 
> ----- Original Message ----
> From: Roberto Ortelli <[EMAIL PROTECTED]>
> To: jquery-en@googlegroups.com
> Sent: Monday, April 16, 2007 1:18:15 PM
> Subject: [jQuery] Re: to change tab for enter
> 
> 
> Just a first attempt, I don't like it, and you need to add a few lines
> of code ; )
> 
> $("[EMAIL PROTECTED]").bind("keydown",function(e){
>     if (e.keyCode == 13) {
>         tabIndex = parseFloat($(this).attr("tabindex")) + 1;
>         $("[EMAIL PROTECTED]")[tabIndex].focus();
>         return false;
>     }
> });
> 
> 
> 2007/4/16, Fabyo <[EMAIL PROTECTED]>:
>>
>>
>> [b]onsubmit[/b] = ( is use Unobtrusive JavaScript
>>
>>
>> Leonardo K wrote:
>> >
>> > Start tabindex with number 1.
>> >
>> > Without label:
>> >
>> > <form action="#" method="get" onsubmit="return false;">
>> >        Campo 1: <input type="text" name="campo1" tabindex="1" /><br />
>> >        Campo 2: <input type="text" name="campo2" tabindex="2" /><br />
>> >        Campo 3: <input type="text" name="campo3" tabindex="3" /><br />
>> >        Campo 4: <input type="text" name="campo4" tabindex="4" /><br />
>> >        Campo 5: <input type="text" name="campo5" tabindex="5" />
>> >        <input type="submit" name="sub" id="sub" value="Enviar" />
>> > </form>
>> >
>> > With label:
>> >
>> > <form action="#" method="get" onsubmit="return false;">
>> >        <label for='campo1'>Campo1: </label> <input type="text"
>> > name="campo1"
>> > id='campo1' tabindex='1'/><br />
>> >        <label for='campo2'>Campo2: </label> <input type="text"
>> > name="campo2"
>> > id='campo2' tabindex='2'/><br />
>> >        <label for='campo3'>Campo3: </label> <input type="text"
>> > name="campo3"
>> > id='campo3' tabindex='3'/><br />
>> >        <label for='campo4'>Campo4: </label> <input type="text"
>> > name="campo4"
>> > id='campo4' tabindex='4'/><br />
>> >        <label for='campo5'>Campo5: </label> <input type="text"
>> > name="campo5"
>> > id='campo5' tabindex='5'/>
>> >        <input type="submit" name="sub" id="sub" value="Enviar" />
>> > </form>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/to-change-tab-for-enter-tf3584151s15494.html#a10021923
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Roberto Ortelli
> http://weblogger.ch
> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/to-change-tab-for-enter-tf3584151s15494.html#a10058410
Sent from the JQuery mailing list archive at Nabble.com.

Reply via email to