【问题标题】:Getting value of unselect option in jQuery chosen plugin在 jQuery selected 插件中获取 unselect 选项的值
【发布时间】:2014-05-21 13:55:00
【问题描述】:

在获取文本时,我没有获得取消选择选项的值

$('#f_profession').chosen().change(function (evt, params) {
    alert($(this).text())
    if (params.deselected) {
        alert($(this).val())
    }
});

【问题讨论】:

  • 我在文档中找到了这个注意:为了在原型版本中使用更改,您必须包含 Event.simulate 类。选择和取消选择的参数对 Prototype 不可用您使用的是 Prototype 版本吗?
  • 如何检查它的原型?
  • 你需要回去阅读插件的文档,然后确定你下载了什么。
  • 我 rad 它但在那里找不到,我只是知道如何获取这样的更改事件:$('#f_profession').chosen().change(function (evt, params) {}); 没有别的如何找到值。

标签: php jquery jquery-chosen


【解决方案1】:
$(document).ready(function(){
    $('#f_profession').chosen().change(function () {
        $(this).find('option:not(:selected)').each(function(){
        alert('Text : '+$(this).text());
        alert('Value : '+$(this).val());
         });
    });
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-15
    • 2013-10-09
    • 2015-08-20
    • 1970-01-01
    • 2012-05-18
    • 2016-12-01
    • 2013-12-17
    • 1970-01-01
    相关资源
    最近更新 更多