脚本宝典收集整理的这篇文章主要介绍了php – 使用jQuery表单规则显示时验证文本框,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
但我的问题是
1)我想在显示时验证其他文本框.
如何验证任何Suggesstions请..
<form name="f2" id="f2" method="post" action="" enctyPE="multipart/form-data"> Type: <select name="type" id="type" onchange='CheckColors(this.value);'> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="others">others</option> </select> <input type="text" name="others" id="others" style='display:none;'/> <input type="submIT" name="submit"/> </form>
//这是验证表单的脚本..我想在它出现时验证另一个文本框..怎么做?
<script type = "text/javascript"> $(document).ready(function () { $("#f2").validate({ debug: false,rules: { type: { required: true },others: { required: true },messages: { //messages for required } }); }); </script>
我尝试了上述过程,但它总是并排显示所需的两次.
$(document).ready(function () { $("#f2").validate({ debug: false,rules: { type: { required: true },messages: { //messages for required } } }); }); function CheckColors(value) { if(value=='others') { $('#others').show().attr('required','required'); } else { $('#others').hide().removeAttr('required'); } }
others: { required: true }
以上是脚本宝典为你收集整理的php – 使用jQuery表单规则显示时验证文本框全部内容,希望文章能够帮你解决php – 使用jQuery表单规则显示时验证文本框所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。