Jump between inputs with a specific class

0

I have the following code to jump between inputs that have clase amount with the key enter , this function I assign it to the inputs when I create them at the level of javascript . Neither the focus nor the select are working for me. Use the .next to locate me in the next inp with class amount saving it in variable a . Doing console.log of a does not show me only the following but all inputs with class monto .

$(monto_inp).on('keydown', function () {

    $(".monto").keypress(function (e) {
        //console.log(e);
        if (e.which == 13) {
            var a = $( ".monto" ).next( ".monto" );
            console.log(a);
            a.focus();
            a.select();

        }
    });
});

EDIT1: I believe it this way, this input creation is triggered when someone touches a button, so they are n amount of amount_inp

// Creacion de input para "monto"
var monto_inp = document.createElement("input");
monto_inp.name = "monto";
monto_inp.placeholder = "Monto";
monto_inp.classList.add('detalle_pago');
monto_inp.classList.add('monto');

This is what the console.log shows

    
asked by Kinafune 28.08.2018 в 16:26
source

0 answers