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

标签 jquery

我正在尝试验证 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/

相关文章:

jquery - 使用 jQuery Mobile 的动态页面

javascript - 附加选择设置值jquery

javascript - jQuery:根据单击的按钮隐藏/显示表行

jquery - event.originalEvent 在具有 jQuery 自动完成功能的焦点事件中未定义

javascript - 当窗口宽度达到865px时重新启动greensock(JS)动画

javascript - 如何使用 jQuery 减少 `li` 中 `select2` 的填充?

jquery - 如何使用.toggle函数?

javascript - Jquery文字动画

javascript - 使用 jQuery 在父/集中查找选择器位置?

jquery - Boilerplate js文件调用方法