在一个简单的搜索输入
$('#search-basic').val(''); // and value is correctly deleted
$('#search-basic').focus(); // highlighted but no cursor inside input
$('#search-basic').trigger('change'); // not work (result list not deleted)
我试过了
setTimeout(function(){$('#search-basic').focus()}, 50);
或者
$("#search-basic").focus(function() {
$(this).val('');
$(this).trigger('change');
$(this).select();
});
$("#search-basic").mouseup(function(e){
e.preventDefault();
});
$('#search-basic').focus();
同样的结果......