<style>
ul li.on {
background: #eee;
}
</style>
$('#keyword').on('keydown',function(e) {
if(e.which == 13) {
let liOn = $('#list li.on');
if(liOn && liOn.length > 0){
liOn.find('a').click();
}
else {
$('#search').trigger('click');
}
}
else if(e.which == 40){
fn_downUpItem('down');
}
else if(e.which == 38){
fn_downUpItem('up');
}
else{
$('#list').html('');
}
});
<ul id="list">
</ul>