我使用 jquery 插件(选择)处理输入名称选择框
在我的工作限制中
在 input type=text 元素中输入一个元素(使用选择的插件选择框)<- OK
从弹出窗口中输入一个输入类型=文本元素到选定的用户名。<-不能!
我想在选择框中添加动态选项。
所以,我被添加到选择的子节点中;
这是我的 HTML 代码
<select data-placeholder="Please enter your name" class="chosen-select chosen_member2" multiple style="min-width:400px;width:auto;float:left;height: 30px;" tabindex="4">
</select>
这是我的 Jquery 代码
$(".chosen-choices").eq(0).find(".search-field").before("<li class=\"search-choice\"><span>"+uname+" (Executive Dept)</span><a class=\"search-choice-close\" data-option-array-index=\""+auto_num+"\"></a></li>");
$('.chosen-choices').eq(0).trigger("chosen:updated");
并且,成功添加选项元素。
如果将选项元素添加到选择框中,则下拉项之一处于非活动状态。
但是,在我的情况下,将一个元素添加到一个选择中,其中一个下拉项是活动的。
所以!,
尽管添加了一个元素,但 Option Element 仍然是活跃的。(当我将输入类型 = 文本元素添加到选择的选择类中时,我需要非活动选项)