javascript - tab key is not working as expected when using jquery change event -


i had weird result jquery events, though not convinced whether jquery issue. hope jquery geeks can answer this.

i had following code snippet in html page, change focus second input box once user enter string of length 9 in first input box. auto-focusing working smoothly. when press tab first input box, skipping second input box , goes next html element second input box.

$("input.first").change(function (e){     var text = $(this).val();     if (text.length == 9){         $("input[id='second']").focus();     } }); 

i tried putting tabindex property html elements still continued misbehavior. @ end when changed change event keypress event tab key started flow expected.

is there explain why happens? answers.

you can add tab index controls manually. hope work.

$(function() {   var tabindex = 1;   $('input').each(function() {      if (this.type != "hidden") {        var $input = $(this);        $input.attr("tabindex", tabindex);        tabindex++;      }   }); }); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -