I think you need to wait until the browser gives focus to the element, and then make your choice:
$('.class-focusin').focus(function(e) { var $elem = $(this); setTimeout(function() { $elem.select(); }, 1); });
Ugh. Or just bind the click event:
$('.class-focusin').click(function(e) { $(this).select(); });
Codingintrigue
source share