Reputation: 81
How to add multi line place holder text in textarea? .
I got a solution like following but its not working im mossilla, safari.
Chrome works this way..
$('#nameTxtBox').attr("placeholder", "League Name \n 1-2 lines most designs");
Upvotes: 1
Views: 3235
Reputation: 1790
Try This code
just add "
" before the new line without space.
<textarea placeholder='First Line Second Line Third Line' rows="5"></textarea>
Upvotes: 2
Reputation: 1704
Unfortunately multi-line placeholders are not supported as a rule. Chrome does allow for newline characters, but support across platforms can be spotty. The recommended course of action would be to create shorter, single-line placeholders. If you absolutely need a multi-line placeholder, you can try this:
<textarea style='white-space:pre;' placeholder='Line 1
Line2'></textarea>
By adding the css attribute white-space:pre
, you force the textarea to treat the placeholder text as preformatted text. Again, though, support is spotty.
Upvotes: 1