Rails auto select text field
def auto_select_text_field_tag(name, value = nil, options = {}) text_field_tag(name, value, { :onclick => "$(’#{name}’).select()", :readonly => "true" }.merge(options)) end
A _little_ more info on my blog.
~Barry Hess
DZone Snippets > bjhess > on
11387 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Barry Hess http://blog.bjhess.com
def auto_select_text_field_tag(name, value = nil, options = {}) text_field_tag(name, value, { :onclick => "$(’#{name}’).select()", :readonly => "true" }.merge(options)) end