[英]trigger an browser alert when submitting a form
im trying to let the user know that he submitted his form by a simple alert, but somehow this leads to not working.我试图让用户知道他通过一个简单的警报提交了他的表单,但这会导致无法正常工作。 To do this I bound a onClick function to the type="submit" field.
为此,我将 onClick function 绑定到 type="submit" 字段。
here are my code snippets这是我的代码片段
<div class="col-md-12">
<input onclick="formSuc" type="submit" class="btn btn-box" value="ABSENDEN">
</div>
<script>
function formSuc() {
alert("Test");
}
</script>
Change your onclick property to this:将您的 onclick 属性更改为:
onclick="formSuc()"
This way, your function will execute onclick .这样,您的 function 将执行onclick 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.