I am currently working with reading data from a USB card rea开发者_Python百科der and it sends a page submit command along with the card track data.
Is there a way for me to detect a page submit command and can I programmatically disable the submit command?
In HTML it's super-easy:
<form onsubmit="return false">
You also do it via code in JQuery like so:
$('#form_id').submit(function(e) {
e.preventDefault();
return false;
});
Handle the form's submit
event and return false
if you want it to be canceled.
For example:
$('form').submit(function() {
//Do something
return !hadErrors;
});
精彩评论