我希望为用户提供添加自己的变体的可能性,而不仅仅是建议的变体.但是当我在字段中键入内容并单击ENTER时,我的表单会提交.
然后我尝试捕获我的字段的keydown事件,但在这种情况下,我没有可能从使用箭头的建议中选择变体并输入键,因为ui参数未定义.
$('#field_id').on('keydown', function(event) {
if (event.keyCode == $.ui.keyCode.ENTER
|| event.keyCode == $.ui.keyCode.NUMPAD_ENTER)
{
$('#field_id').trigger('autocompleteselect');
}
});
$('#field_id').autocomplete({
source: [{"id":"20","value":"This is not mandatory decline reason"},{"id":"21","value":"You are have to be rejected"}]
minLength: 0
}).on('autocompleteselect', function(event, ui) {
// if I click on suggestion using mouse - everything is ok
// but not for ENTER-key choosing
// I want something like that:
if (ui.item) {
id = ui.item.id;
value = ui.item.value;
} else {
id = 'my_new_item';
value = $(this).val();
}
return …Run Code Online (Sandbox Code Playgroud) 我正在寻找正确的方法来使用项目中的phpDoc-comments来生成我的Confluence 4.1.4中的开发人员文档.