I have a li开发者_JAVA技巧st box (i.e., select tag), and I want to verify that atleast a single value is been selected, using jQuery
I have included jQuery and jQuery Validate plugin
Anyone have solution?
ThanksUse both the required
and minlength
rules here, for example:
$("form").validate({
rules: {
selectName: {
required: true,
minlength: 1
}
}
});
try using the "selected" selector and checking it for null/undefined:
if($("#ListBox1 > option[@selected]") != null)
{
//whatever code you need
}
精彩评论