【发布时间】:2018-04-13 10:06:38
【问题描述】:
我想验证我的表单,并使用 onsubmit 创建了一个 formValidation 函数,该函数从 js.js 文件中调用一个函数。但是,当我单击提交时,我收到此错误:
这是必要的表单代码:
<form action="send-email.php" id="callback" class="popup-form" method="post" onsubmit="return validateForm()">
// Form content
</form>
这里是功能代码:
function validateForm() {
console.log("hellloooooo this is working");
// var captcha_response = grecaptcha.getResponse();
// if(captcha_response.length === 0)
// {
// // Captcha is not Passed
// console.log("not working");
// return false;
// }
// else
// {
// // Captcha is Passed
// console.log("working");
// return true;
// }
}
脚本标签在正文标签内,所以它应该可以工作..我哪里出错了??
【问题讨论】:
-
请发布您的完整 HTML 代码。
-
在线处理程序只能找到全局函数。
-
@Teemu 对,我的错……已删除。
标签: javascript html forms function onsubmit