Property 'submit' of object # is not a function
<form action="" type="get" > <input type="button" name="submit" > </form>
点击按钮,触发表单提交:
document.getElementById("subBtn").onclick=function(){ document.getElementById("form").submit(); }
会报错(chrome下):
Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function
原因是name="submit"这句,换成别的name=sb1,sb2,sb2。。。
另外,经测,将,也会这样
同理,用于reset
一句话!!:
在表单里,别用name="submit|reset" 或
ps:今天遇到了此错误,纠结了半天,记录一下,以警醒。