从 office ui 结构核心的下拉列表中获取/检索所选选项的值/数据属性

问题描述

我正在使用 jquery 将选项列表添加到我的下拉列表中,我的选项看起来像这样


    <option value="7f8a19e6-18b8-47e4-b60f-bd8a4880a224">10-city health club</option>

我想检索我从下拉列表中选择的选项的“值”。

选定的选项和列表如下所示:

<span class="ms-Dropdown-title">abc</span>

<ul class="ms-Dropdown-items">
<li class="ms-Dropdown-item">Select Project</li>
<li class="ms-Dropdown-item">abc</li>
<li class="ms-Dropdown-item">10-city health club</li>
</ul>

解决方法

我们可以得到选中的选项值

 var id = $('#idOfTheSelectTag :selected').attr('value');

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...