引导程序中的jQuery组合框onchange事件无法正常工作 [英] jQuery combobox onchange event in bootstrap not working

查看:94
本文介绍了引导程序中的jQuery组合框onchange事件无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这个插件来实现 combobox 。此外,我需要获取选择列表的值,所以我添加了以下代码:

I am using THIS plugin to implement combobox . Also I need to get the value of the select list, so I have added the following code :

$(document).ready(function(){
      $('.combobox').combobox({
          select: function (event, ui) { 
            alert("the select event has fired!"); 
        } 
      });
  });

stackoverflow解决方案。但在我的情况下,没有显示警报!如何获得所选的期权值?

stackoverflow solution. But in my case no alert is shown ! How can I get the selected option value ?

JSFiddle

推荐答案

检查插件主页,我没有找到任何名为select的选项。

Checking the plugin homepage, I didn't find any option called select.

您可以在创建的文本字段中添加更改事件并选择值。

You can add a change event to the textfield created and select the value.

 $("input[type='text'].combobox").on("change", function () {
      alert($(this).val());
 });

演示小提琴

这篇关于引导程序中的jQuery组合框onchange事件无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆