chrome does not support the form.submit solution
- 2020-06-03 05:46:57
- OfStack
Recently I saw someone in the Q group saying that chrome (Google browser) does not support the form.submit method. In my spare time, I personally tested 1, and found that chrome really did not support form.submit was used in the test, but it did not support Jquery. So I studied for a long time and finally found a solution.
// To obtain form The form of id
var form=$('#myform').val();
// Get browser parameters
var browserName=navigator.userAgent.toLowerCase();
if(/chrome/i.test(browserName)&&/webkit/i.test(browserName)&&/mozilla/i.test(browserName)){
// If it is chrome The browser
var tmp=theform.attr('Edit');
$.post(tmp,theform.serialize());
}else{
// perform SUBMIT
form.submit();
}
This is the end of this article, I hope you enjoy it.