我有一个输入字段,我想要做的是,一旦网站加载,它将触发对输入的单击,然后向下箭头,最后输入我尝试了下面的代码,但我无法实现
HTML:
<input type="text" name="location" class="location" id="destination-autocomplete" placeholder="Enter a location" autocomplete="off">
JS
$('#destination-autocomplete').trigger(jQuery.Event('keypress', { keycode: 13 }));
$('#destination-autocomplete').trigger(jQuery.Event('keypress', { keycode: 40 }));
$('#destination-autocomplete').trigger(jQuery.Event('keypress', { keycode: 13 }));
答案 0 :(得分:0)
将其包装成文档就绪
select col1,col2.....col38,
max(col6) over(partition by col1,col2 order by col1) as max_val
from tablename
答案 1 :(得分:0)
即使您可以,我也不认为您应该这样做。 好像您有或想要某种自动完成的文本字段。在这种情况下,只需修改自动完成文本字段的模型,不要尝试通过按键事件来预先选择一个项目。
答案 2 :(得分:0)
您可以使用普通的JS DOMContentLoaded来做到这一点:
document.addEventListener('DOMContentLoaded', function(){
$('#destination-autocomplete').trigger(jQuery.Event('keypress', { keycode: 13 }));
$('#destination-autocomplete').trigger(jQuery.Event('keypress', { keycode: 40 }));
$('#destination-autocomplete').trigger(jQuery.Event('keypress', { keycode: 13 }));
})