本文介绍了选项[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]不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-27 03:28