Reputation: 75
In the form of my rails app i created a text area using the ruby language:
<%= f.text_area :feed_text, class: "text_box", autofocus: true ,:value => "my default text" %>
so the thext, when i open the page, is there, but i want that , like in a lot of social networks, when i click on the text area the default text is deleted or selected.
Upvotes: 1
Views: 280
Reputation: 9764
you can use placeholder from html5 rather than value:
<%= f.text_area :feed_text, class: "text_box", autofocus: true ,:placeholder => "my default text" %>
Note that placeholder doesn't actually put the value in your text box, but shows to the user 'greyed out' so they know what to enter.
Alternatively see: http://davidwalsh.name/html5-placeholder for a fallback method for older browsers
Upvotes: 1