how can you so that the text in the text field is selected when the user clicks on the text input field?
i have used this code:
$("input[type=text]").focus(function() {
$(this).select();
});
but it doesnt work in safari. and in FF it works sometimes.
The
select()method in jQuery simply triggers the select event on all matched objects. You need to do something fancier if you want to manipulate the selected range of text in a textbox. Modern browsers behave differently here.The following code should work in Chrome, Firefox, IE, Safari, and Opera: