jquery – 使用选择性从选定内容中获取文本

栏目: jQuery · 发布时间: 7年前

内容简介:select_option.getItem(select_option.getValue())[0] .innerHTML;select_option = $select_option [0] .selectize;获取指定下拉选项的文本值.

我试过这个:

var eventHandler = function() {
    return function() {
        console.log($select.val());
    };
};
var $select = $('.selectize').selectize({
    create          : true,
    onChange        : eventHandler()

});

这让我了解所选选项的价值,但我需要文本.我这样做的时候:

console.log($select.val().text());

我收到一个错误.我尝试过其他事情无济于事.如何获取所选文本?

select_option.getItem(select_option.getValue())[0] .innerHTML;

select_option = $select_option [0] .selectize;

获取指定下拉选项的文本值.

this.getItem(value)[0] .innerHTML获取当前下拉选项的文本值

翻译自:https://stackoverflow.com/questions/25090571/get-text-from-selected-using-selectize


以上所述就是小编给大家介绍的《jquery – 使用选择性从选定内容中获取文本》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Artificial Intelligence

Artificial Intelligence

Stuart Russell、Peter Norvig / Pearson / 2009-12-11 / USD 195.00

The long-anticipated revision of this #1 selling book offers the most comprehensive, state of the art introduction to the theory and practice of artificial intelligence for modern applications. Intell......一起来看看 《Artificial Intelligence》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具