Reputation: 5931
I'm waiting for user input like this:
prompt('hello', 'world');
I don't understand why my prompt defaultText 'world' is selected.
Not a big deal, just curious, but I'd like to focus on first character without selection.
Is there some kind of placeholder for javascript prompt box or a way to do it (in pure javascript) ?
Upvotes: 1
Views: 419
Reputation: 5483
prompt(text,defaultText)
The default input text shown as selected to save user time to override it easily. All browsers are doing same except Safari.
Upvotes: 0
Reputation: 174957
Well, it's a UX feature. The default is "world" but if I wanted to override it, I can just start typing, it saves me from selecting all of it. If I wanted to append to it, all I need to do is press the left arrow.
Upvotes: 1