【问题标题】:jQuery Autocomplete Combobox - Clear selection on focusjQuery自动完成组合框 - 清除焦点上的选择
【发布时间】:2015-05-06 00:24:41
【问题描述】:

使用 jQueryUI Combox 小部件,我如何自引用 input 元素?在下面的代码中,我希望.click() 事件清除input 的值,并希望.blur() 事件重新分配之前的值。

this.input = $('<input id="somebox">')
  .click(function() { ??? })
  .blur(function() { ??? })

【问题讨论】:

    标签: javascript jquery jquery-ui jquery-ui-autocomplete


    【解决方案1】:

    我想我不明白你真正想要做什么。 但是下面的代码会按照你说的做。

    this.input = $('<input id="somebox">')
      .click(function() { this.preValue = $(this).val(); $(this).val('');})
      .blur(function() { $(this).val(this.preValue);})
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-06
      • 2012-07-21
      • 1970-01-01
      • 2012-10-28
      • 2014-09-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多