【问题标题】:Autocomplete with multipleSeparator not working in IE使用多个分隔符的自动完成功能在 IE 中不起作用
【发布时间】:2013-08-22 13:17:37
【问题描述】:

我正在使用这个 jQuery 代码进行自动补全。

多重选择在 Firefox 和 Chrome 中运行良好,但在 IE 中不行。 请给我一个解决方案..

如何将搜索到的文本对应的id(唯一id)填充到隐藏变量中...

JavaScript

    $().ready(function() {
        $("#course").autocomplete("ajax.php", {
            width: 260,
            matchContains: true,
            mustMatch: true,
            minChars: 0,
            multiple: true,
            highlight: false,
            multipleSeparator: ",",
            selectFirst: false
        });
    });

HTML

<input type="text" name="course" id="course" />

【问题讨论】:

  • 尝试将文档添加到您的就绪处理程序 $(document).ready(function() {});
  • 您没有收到TypeError: Cannot call method 'ready' of null 错误,因为您没有为$() 传递任何内容吗?
  • @Yoda .. NO.. 两者都可以工作..
  • $( ... ).ready 中缺少文档

标签: jquery ajax autocomplete


【解决方案1】:

不确定您使用的是 WordPress 还是可能需要显式包装器的东西,但您的自动完成语法看起来还不错。尝试在它周围放置最明确的文档就绪包装器,看看是否可以在 IE 中修复它:

jQuery(document).ready(function($) {
  $('#course').autocomplete('ajax.php', {
    width: 260,
    matchContains: true,
    mustMatch: true,
    minChars: 0,
    multiple: true,
    highlight: false,
    multipleSeparator: ',',
    selectFirst: false
  });
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-28
    • 2020-11-14
    • 2014-03-11
    • 2014-01-16
    • 2011-03-14
    • 2013-12-23
    相关资源
    最近更新 更多