Home >Web Front-end >JS Tutorial >Chrome does not support form.submit solution_javascript tips
I recently saw someone in the Q group saying that chrome (Google browser) does not support the form.submit method and asked for a solution. I tested it myself in my spare time and found that chrome really does not support form.submit. The Jquery used during the test did not support it either. So after researching for a long time, I finally found a solution.
//获取form表单的id var form=$('#myform').val(); //获取浏览器参数 var browserName=navigator.userAgent.toLowerCase(); if(/chrome/i.test(browserName)&&/webkit/i.test(browserName)&&/mozilla/i.test(browserName)){ //如果是chrome浏览器 var tmp=theform.attr('Edit'); $.post(tmp,theform.serialize()); }else{ //执行SUBMIT form.submit(); }
The above is the entire content of this article, I hope you all like it.