http://jsfiddle.net/ssthil/zj7F8/
它没有开火,我错过了哪里?你能帮忙吗?
http://jsfiddle.net/ssthil/zj7F8/
它没有开火,我错过了哪里?你能帮忙吗?
Here you go: http://jsfiddle.net/jZVA2/
If I may suggest read the plugin again. http://bassistance.de/jquery-plugins/jquery-plugin-validation/ documentation http://docs.jquery.com/Plugins/Validation
Few things are missing:
submit
script
Hope it fits your needs :)
code
$(document).ready(function() {
$('#mainForm').validate();
});
Bit complicated version here: http://jsfiddle.net/AvJNk/
<script type='text/javascript' src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"> </script>
您必须更改输入类型按钮才能提交并记住它适用于您的名称属性而不是您的 id,如下所示
<input type="text" name="mytxtName" id="mytxtId" />
会有这样的代码
$(document).ready(function() {
$('#mainForm').validate({
rules: {
mytxtName: {
required: true
}
}
});});
在此处检查工作代码...