开发者

verify list box value is selected

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?

Thanks


Use 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
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜