gpt4 book ai didi

jquery 验证插件在 modalbox 中不起作用

转载 作者:行者123 更新时间:2023-12-01 05:11:21 25 4
gpt4 key购买 nike

我正在尝试验证 modalbox 中的字段,但是下面是我的验证代码,它不起作用

$("#formapplication").validate({
rules: {
tb_name:{ required: true },
tb_url: {required: true},
tb_tag: {required: true},
tb_desc: {required: true},
tb_catg: {required: true}
},
messages:{
tb_name:{ required: "Please Enter Full name" },
tb_url: {required: "Please Enter URL"},
tb_tag: {required: "Please Enter Tag."},
tb_desc: {required: "Please Enter Description."},
tb_catg: {required: "Please Select Category."}
}
});

jquery 验证插件支持 modalbox,但我在同一页面上编写的简单 html 不使用 ajax 调用任何想法 pelase 帮助。

下面是xhtml

<div id="submitapplication" style="display:none">
<form action="" id="formapplication" name="formapplication" method="post">
<div class="submitapplicationbox">
<label>Name<input type="text" name="tb_name" id="tb_name" /></label>
<label>Url<input type="text" name="tb_url" id="tb_url" /></label>
<label>Tags<input type="text" name="tb_tag" id="tb_tag" /></label>
<label>Category<select name="select" id="tb_catg">
<option value=""></option>
</select></label>
<label>Description
<textarea cols="" rows="" name="tb_desc" id="tb_desc" ></textarea></label>
</div>
<div class="twiteraccountinfobox">
<label>Name<input type="text" name="tb_twaccount" id="tb_twaccount" /></label>
<div style="margin-top:20px;"><input type="button" id="submitapp" value="Submit Application" /></div>
<div id="response" style="display:none;"></div>
</div>

最佳答案

我缺少用于验证的所有输入所需的类

<input type="text" id="tb_name" class="required" />

关于jquery 验证插件在 modalbox 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/665680/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com