【发布时间】:2011-04-17 00:03:50
【问题描述】:
jQuery.validate 默认情况下似乎不会更改无效元素的背景颜色。是否也可以更改select 元素的背景颜色?我的大部分元素都是input type="text",但我需要一个用于选择表单元素的指示器。我不使用默认生成的消息,因为它们不适合我的布局。
以下代码确实改变了input元素的背景颜色,但它永远不会恢复到以前的样式:
编辑(示例)
<div class="field">
<div class="labelName_fb">
<label for="email">Email</label>
</div>
<div class="divforText3">
<div class="divLeft"></div>
<div class="textbox-image3">
<input class="txt required" id="emailCreate" name="emailCreate" value="" maxlength="100" type="text" style='width:180px'>
</div>
<div class="divright"></div>
</div>
</div>
input 元素在错误时被赋予jqInvalid 错误类。
CSS
/* line 3 */ .error { background: #ffdddd; } /* I have since removed the errorClass option */
/* line 254 */ .field .txt {background:transparent none repeat scroll 0 0;border:medium none;color:#000;font-size:11px;width:130px; margin:5px 0;}
【问题讨论】:
标签: jquery css jquery-plugins jquery-validate