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

Chrome does not support form.submit solution_javascript tips

WBOY
WBOYOriginal
2016-05-16 16:01:491678browse

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.

Statement:
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