Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Barcode reader calling submit function in my form

I have a simple form to recharge account. In this account i am reading the card number through bar code reader but this bar code reader calls the submit function immediately after putting the value in it. I want to stop bar code reader from calling the submit function because i have other fields to fill before submit. I want to know how can i stop bar code reader calling submit function j query.

like image 624
Ranjeet SIngh Avatar asked Mar 20 '23 06:03

Ranjeet SIngh


1 Answers

$(":input").keypress(function(event){
    if (event.which == '10' || event.which == '13') {
        event.preventDefault();
    }
});

I used this jquery to solve my problem to prevent it calling submit function

like image 83
Ranjeet SIngh Avatar answered Apr 06 '23 08:04

Ranjeet SIngh