我需要在用户首次按下箭头时执行一个功能(以确保用户下降到ui-autocomplete)然后输入。有什么建议?这是我目前的代码:
Traceback (most recent call last):
File "preproc.py", line 89, in <module>
apos=stem_data(nostop)
File "preproc.py", line 51, in stem_data
r=stemmer.stem(n)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nltk/stem/porter.py", line 632, in stem
stem = self.stem_word(word.lower(), 0, len(word) - 1)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nltk/stem/porter.py", line 590, in stem_word
word = self._step1ab(word)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nltk/stem/porter.py", line 275, in _step1ab
if word.endswith("sses"):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 6: ordinal not in range(128)
答案 0 :(得分:0)
如果您只是需要在downArrowKey
键之前截取enter
,则可以将符合条件的downArrowKey
条件保存到global
变量,并检查它&#39; s值和enter
键。
var count = 0;
var downArrowPressed = false;
$('#this_is_input').keyup(function(e) {
if(e.keyCode != 13) {
downArrowPressed = e.keyCode == 40 ? true : false; }
console.log(downArrowPressed);
// downArrowPressed = true;
// I need to make sure the user hit arrow down before executing the $('.submitBtn').click();
if (e.keyCode == 13 && downArrowPressed) {
// First enter pressed
if(count == 0)
{
downArrowPressed = false;
alert('Submit');
// $('.submitBtn').click();
// CONFIRM_LOCATION.attr('disabled', 'disabled');
}
// count++;
}
});