use*_*550 84 safari jquery select google-chrome focus
我有以下jQuery代码(类似于这个问题),可以在Firefox和IE中使用,但在Chrome和Safari中失败(没有错误,只是不起作用).任何解决方法的想法?
$("#souper_fancy").focus(function() { $(this).select() });
Run Code Online (Sandbox Code Playgroud)
小智 187
这是导致选择未被选中的onmouseup事件,因此您只需要添加:
$("#souper_fancy").mouseup(function(e){
e.preventDefault();
});
Run Code Online (Sandbox Code Playgroud)
Ale*_*007 25
$('#randomfield').focus(function(event) {
setTimeout(function() {$('#randomfield').select();}, 0);
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
77224 次 |
最近记录: |