A code is worth a thousand words

jQuery: Input - focus and select all

You are here

How to focus and select all using javascript. This snippet shows it in an example of "jQuery: Toggle input text using checkbox". For an example you can extend this to any event or action where you need to show prefilled text input.