选项[selected = true]不起作用 [英] option[selected=true] doesn't work

查看:463
本文介绍了选项[selected = true]不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个命令(visibleSelect是包含多个选择列表的jquery变量):

I have this command (visibleSelect is jquery variable that holds multiple select list):

var selectedOption = visibleSelect.find('option[selected=true]');

从观察窗口我可以看到 selectedOption.length 是0,但是 visibleSelect.get(0)[1] .selected true

From the watch window I can see that selectedOption.length is 0, but visibleSelect.get(0)[1].selected is true.

为什么 selectedOption 不包含所选选项?有什么问题?

Why selectedOption doesn't containt the selected option? What is wrong?

推荐答案

尝试

var selectedOption = visibleSelect.find('option:selected');

这篇关于选项[selected = true]不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆