开发者

HTML textarea: How to display text with newline, spacing?

I have a 'pre-populated' text area, where I want something in the order of:

Hi, enter开发者_StackOverflow中文版 some text here
    And press submit:)

(Just as example, I know it sounds stupid) ...To be displayed on page load. If I enter it verbatim in the HTML it displays as:

Hi, enter some text here

And press submit:)

Any ideas? thanks.


You need to have a tab in there

$val = "Hi, enter some text here \n \tAnd press submit:)"; //adds a newline and tab

And your HTML

<textarea>
<?php echo $val ?>
</textarea>

You might have to modify this a bit by adding placeholders if you want the tab characters to appear in different places.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜