Uncaught TypeError: XX is not a function at HTMLInputElement.onclick
来源:互联网 发布:上古卷轴5男捏脸数据 编辑:程序博客网 时间:2024/06/01 19:29
<div class="btn_Div" id="operations-btn" hidden="hidden"> <input type="button" value="通过" class="btn-accept" hidden="hidden" id="accept-btn" onclick="accept();" /> <input type="button" value="拒绝" class="btn-reject" hidden="hidden" id="reject-btn" onclick="reject();" /> <input type="button" value="提交审批" class="btn-add" hidden="hidden" id="submit-btn" onclick="accept();" /></div><script>function accept() { ...}</script>
代码如上。
点击【提交审批】按钮就报 Uncaught TypeError: accept is not a function at HTMLInputElement.onclick
这样的错误。
上网搜了一下,报错原因应该是如果有某个 input
元素的 name
或者 id
与 JS 函数同名的话就会产生冲突,不能正常调用。
解决办法就是改一下元素的 id/name
或者改函数名。
我把函数名改成 acceptApproval()
就解决了。
stackoverflow上的相关解答:
“uncaught TypeError: Object is not a function” in JavaScript
JS: Uncaught TypeError: object is not a function (onclick)
1 0
- Uncaught TypeError: XX is not a function at HTMLInputElement.onclick
- Uncaught TypeError: XX is not a function at HTMLInputElement.onclick
- Uncaught TypeError: search is not a function at HTMLAnchorElement.onclick (airport.do:70)
- 关于Uncaught TypeError: type is not a function at HTMLAnchorElement.onclick (indexjsp:71)的解决
- Uncaught TypeError: download is not a function at HTMLAnchorElement.onclick (index.html:25)
- 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
- JPEG数据转YUV数据应用实例
- java环境变量配置
- 数据结构-C++实现(二):单向链表
- [Unity基础]移动平台下的文件读写
- [Android N]MediaRecorder系列之StagefrightRecorder录制TS流flow(四)
- Uncaught TypeError: XX is not a function at HTMLInputElement.onclick
- linux命令
- selenium之 浏览器导航栏的三个按钮(back、forward、refresh)
- RunLoop总结:RunLoop基础知识
- 一个非常棒的图片 演示 iptables 与 linux的input或者nat
- 【51Nod 1201】 整数划分
- 简历里列写的一些专业技能
- 关于.NET编译的目标平台(AnyCPU,x86,x64)
- selenium之 时间日期控件的处理