关于JavaScript一个错误 Uncaught TypeError: form.submit is not a function
来源:互联网 发布:飞思卡尔单片机课程 编辑:程序博客网 时间:2024/06/14 16:48
之前在做项目的时候前端遇到一个奇怪的错误,用setTimeout()做一个定时器,当时间到0秒时,提交当前页面上的表单,代码如下:
(额,那个1000%3600/60为啥报错我也不知道,不过并不影响使用。。。)
然而代码运行后总是不会自己提交,经过浏览器调试之后,他报错如图:
提示from.submit is not a function??
经过在网上查询得知,这样的错误是因为在form表单里面有元素的id或者name被写作submit,果然,在form表单里我给一个 input元素id写作了submit
在更改之后,代码运行成功,查询资料知:
表单元素中出现了name=”submit”的元素
这种情况下elemForm.submit();将不会触发表单提交,因为表单原始的submit方法将会被覆盖(formElem.submit就是对该元素的引用)。
另外:
elemForm.submit();不会触发表单的onsubmit事件,如果你的表单必须要在onsubmit里面检查表格内容的话还是不要用这种方式提交了。
阅读全文
0 0
- 关于JavaScript一个错误 Uncaught TypeError: form.submit is not a function
- typeError: form.submit is not a function
- javascript 错误 "Uncaught TypeError: string is not a function"
- javascript 错误 "Uncaught TypeError: string is not a function"
- 关于Jquery错误的解决:Uncaught TypeError: $.post is not a function
- Uncaught TypeError: undefined is not a function
- Uncaught TypeError: string is not a function
- Uncaught TypeError: object is not a function
- Uncaught TypeError: undefined is not a function
- Uncaught TypeError: undefined is not a function
- Uncaught TypeError: object is not a function
- Uncaught TypeError: boolean is not a function
- Uncaught TypeError: $(...).appendChild is not a function
- Uncaught TypeError: sum is not a function
- Uncaught TypeError: search is not a function
- Uncaught TypeError: $(...).Validform is not a function
- Uncaught TypeError: $(...).on is not a function
- Uncaught TypeError: $(...).customFileInput is not a function
- [题解]codeforces413e Maze 2D
- 迭代器模式
- 立创商城 元件封装,ALtium 3D图
- INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113
- homebrew安装mongodb
- 关于JavaScript一个错误 Uncaught TypeError: form.submit is not a function
- Maven打可执行jar包的多种方式
- 二分练习
- hihocoder 1553 区间统计
- linux 下 安装 redis
- 各品牌电脑、台式机及主板启动选择快捷键大全,赶紧收藏!
- java 获取微信用户基本信息
- MOOC清华《面向对象程序设计》第3章:下标运算符重载实验
- UWP下用x:Bind双向绑定ComboBox的SelectedItem