我使用jQuery tools驗證器爲我的web應用程序在ASP.net MVC4。 我想驗證dropdownbox使用驗證器沒有成功。下拉框 - 需要驗證使用jQuery.tools.validator
我已經通過了this的問題,但它並沒有解決我的問題。
我的代碼如下。
$.tools.validator.fn("select[required=required]", function(input, value) {
// If the first item in the list is selected return FALSE
alert("Inside required of dropdown");
if(input[0].options[0].selected)
{
alert("returning false");
en: "Please select value from this drop down"
}
else
{
alert("returning true");
return true;
}
});
它提醒所有的警報,但它這麼想的虛假顯示錯誤信息,而在選擇元素它所選項目的值作爲驗證消息的火災。
任何幫助將appriciated。