select

select(element) -> HTMLElement

Selects the current text in a text input.

Example

Some search boxes are set up so that they auto-select their content when they receive focus.


$('searchbox').onfocus = function() {
  Form.Element.select(this)
  // You can also rely on the native method, but this will NOT return the element!
  this.select()
}

Focusing + selecting: use activate!

The activate method is a nifty way to both focus a form field and select its current text, all in one portable JavaScript call.