我的输入字段有工作验证功能:
$.tools.validator.fn("#password", function(input, value) {
return value!='Password' ? true : {
en: "Please complete this mandatory field"
};
});
$("#form").validator({
position: 'bottom left',
messageClass:'form-error',
message: '<div><em/></div>' // em element is the arrow
});
我的输入字段:
<input type="password" id="password" class="full" value="" name="j_password" required="required" placeholder="Password" />
并为 select 尝试了相同的逻辑,但它不起作用:
$.tools.validator.fn("#environment", function(select, value) {
return value!='Select Environment' ? true : {
en: "Please choose the environment"
};
});
我的选择(不工作):
<select id="environment" style="opacity: 0; "><option value="Select Environment">Select Environment</option><option value="1">Dev</option><option value="2">Test</option></select>
我的选择(效果不佳):
<select id="environment" style="opacity: 0; "><option>Select Environment</option><option>Dev</option><option>Test</option></select>
有人能指出我在哪里犯错以及如何解决吗?
更新:
我正在使用http://jquerytools.org/documentation/validator/index.html