$('#query_txt').change(function() {
return window.location = $('#query_txt').data('url') + '/searches?query=' + $('#query_txt').val();
});
当它是由上输入域的变化#query_txt
触发更改事件
不过,我想执行这个代码时会触发此事件除非此链接,用户点击:
<a href="#" onclick="return false;" class="select2-search-choice-close" tabindex="-1"></a>
我已经尝试过此版本coffeescript但不工作:
unless $(".select2-search-choice-close").click()
$('#query_txt').change ->
window.location = $('#query_txt').data('url') + '/searches?query=' + $('#query_txt').val()
我该怎么办? 谢谢!
的修复http://stackoverflow.com/questions/15586879/when-click-on-close-button-and-when-click-on-suggestions-text-with-select2 谢谢! – hyperrjas 2013-03-26 18:24:04