jQuery 自动完成组合框 - 清除焦点上的选择

jQuery Autocomplete Combobox - Clear selection on focus

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

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

我不明白你真正想做什么。 但是下面的代码将按字面意思执行。

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