Selecting text on focus using jQuery not working in Safari and Chrome Selecting text on focus using jQuery not working in Safari and Chrome google-chrome google-chrome

Selecting text on focus using jQuery not working in Safari and Chrome


It's the onmouseup event that is causing the selection to get unselected, so you just need to add:

$("#souper_fancy").mouseup(function(e){    e.preventDefault();});


$('#randomfield').focus(function(event) {    setTimeout(function() {$('#randomfield').select();}, 0);});


This works fine for input type="text" elements. What kind of element is #souper_fancy?

$("#souper_fancy").focus(function() {    $(this).select();});