locked
How to cancel tab button to tab from dd to mm to yyyy in <input type=date/> RRS feed

  • Question

  • User283528319 posted

    Hi all,

    I want tab button to tab the next form element in a date input.

    <g class="gr_ gr_87 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="87" data-gr-id="87">However</g> it tabs from dd to mm to <g class="gr_ gr_81 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="81" data-gr-id="81">yyyy</g> first. Do you know how can change its attribute?

    thank you

    Friday, January 25, 2019 6:50 AM

All replies

  • User-893317190 posted

    Hi fatihbarut,

    You could listen  your input's keyup event when the user input tab, you could let your next textbox focused.

    Below is a sample.

    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    
    <input type="date" id="date"/> <input type="text" /> <script> $(function(){ $("#date").keyup(function (e) {
    // 9 is tab's keyCode if (e.keyCode === 9) {
    // make the next input focused $(this).next("input").focus(); } }) }) </script>

    The result.

    Best regards,

    Ackerly Xu

    Monday, January 28, 2019 2:35 AM