jquery – 检查是否选择了多个选项

我有下一个选择:
<select name="extra_especialidad[]" multiple="multiple">

由于任何原因,名称与括号一起使用,我无法更改或添加任何内容.

我试图检查选择是否有任何选项,我试过没有成功…

$("input[name=extra_especialidad\\[\\]]").length; //Gives me 0 always
$("input[name=extra_especialidad\\[\\]]").val().length; //gives me error

任何建议?

提前致谢.

解决方法

你可以试试这个( Example):
$("select[name='extra_especialidad[]'] option:selected").length;

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...