On Thu, Mar 23, 2017 at 12:16 PM, Oon-Ee Ng <[email protected]> wrote:

>
> $('input[name="qr_code"]').keypress(function(event) {
>     if (event.keyCode == 13) {
>         deform.appendSequenceItem(this);
>         return false;
>     }
> });
>
>
Just realized though (and this is clear in retrospect) that pressing enter
in the new inputs will trigger submission of the form, as the function is
not registered with the newly created input. To get around that, this is
what I'm now using (event delegation, according to the docs I was
following).

$(document).on("keypress", "input[name='qr_code']", function(event) {
    if (event.keyCode == 13) {
        deform.appendSequenceItem(this);
        return false;
    }
} );

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAGQ70et5Q7DKkuhCNaiMDrH_NiWnjkG4EK3gQ4-hpsRktpKT3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to