题
有人可以看这个代码吗?我正在使用两个插件。一个用于验证形式字段,另一个用于样式形式字段。
表单验证验证表单如果我对表单样式代码进行评论。 (// $('。ul')。jqf1();)我希望两个插件一起使用。
<link href="css/jqf1.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.js"></script>
<script type="text/javascript" src="js/jqf1.english.js"></script>
<script src="js/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.ul').jqf1();
$("#priceform").validate({
rules: {
email: {
email: true,
required: false
},
wordcount: {
required: true,
number: true
},
prating: {
number: true
}
}
});});
</script>
<form action="" method="post" id="priceform">
<ul class="ul">
<li><label for="Name">Name:</label></li><br/>
<li><input type="text" id="name" size="20" name="name" maxlength="100" style="width:250px;" /></li>
</ul>
<ul class="ul">
<li><label for="Email">Email:</label></li><br/>
<li><input type="text" id="email" size="20" name="email" class="required" maxlength="20" style="width:250px;"/></li>
</ul>
<ul class="ul">
<li><label for="username">UserName: <span class="optional">(Optional)</span></label></li><br/>
<li><input type="text" id="username" size="20" name="username" maxlength="20" style="width:250px;"/></li>
</ul>
<ul class="ul">
<li><label for="wordcount">Paper Word Count:</label><br/><a href="#">Calculate Word Count</a></li>
<li style="padding-left:12px;"><input type="text" id="wordcount" size="20" name="wordcount" maxlength="20" style="width:50px;"/><span class="cumpolsory">*</span></li>
<li style="color:green"><label id="totalPrice">$1000</label></li>
<li><label style="font-weight: 500; font-size:10px; color: gray;" for="totalprice">(Total Price)</label></li>
</ul>
<ul class="ul">
<li><label>Plagiarism Rating:</label><br/><a href="#">Free Assessment</a></li>
<li style="padding-left:15px;"><input type="text" id="prating" size="20" name="prating" maxlength="20" style="width:50px;"/><label>%</label></li>
</ul>
<ul class="ul" style="border-bottom:none;">
<li><input type="Submit" id="name" size="20" name="name" value="Reset" maxlength="20" style="font-weight:700" /></li>
<li style="float:right;"><input type="Submit" id="name" size="20" name="name" value="Place Order" maxlength="20" style="font-weight:700" /></li>
</ul>
</form>
解决方案
此URL(http://www.webreference.com/programming/javascript/jquery/form_validation/)是您的参考。
您可以尝试将其放置在页面中的响应方式。
<style type =“ text/css”> #priceform label.error {width:250px;显示:块;向左飘浮;红色;左衬里:10px; } < /style>
其他提示
您是否在CSS文件中添加了“ Label.error” CSS代码以显示错误代码?
尝试:1。将样式调用移至验证后。
或者
- 强制采取一些行动,例如在样式之后发出警报,以确保在验证作业发生之前不会悄悄轰炸脚本。
不隶属于 StackOverflow