Home > Web Front-end > JS Tutorial > Chrome does not support form.submit solution_javascript tips

Chrome does not support form.submit solution_javascript tips

WBOY
Release: 2016-05-16 16:01:49
Original
1702 people have browsed it

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(); 
} 
Copy after login

The above is the entire content of this article, I hope you all like it.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template