make input textbox text selected

I think I read it somewhere but I cannot find it back. I’m sorry if this has been talked about before.

But how do you make the (default) text in a textbox selected/highlighted, so the user can just start typing (replacing the selected text)?

{ type: "input", label: "Favorite food", name: "food", value: "Bananas", // <- Default focus: true, // <- So you can start typing here highlighted: true // How do I do this? Through value or script? }

Use onFocus event and .select method:

myForm.attachEvent("onFocus", function(name, value){ myForm.getInput(name).select(); });