占位符的多行文字

问题描述 投票:-3回答:1

enter image description here

有人可以帮我如何解决这个问题吗?我尝试了一堆东西,但没有任何效果。它是多行占位符文本。

html css comments multiline
1个回答
0
投票

此示例替换所有多行textarea的占位符。

var textAreas = document.getElementsByTagName('textarea');
Array.prototype.forEach.call(textAreas, function (elem) {
elem.placeholder = elem.placeholder.replace(/\\n/g, '\n');
});

IN HTML

<textarea class="textAreaMultiline" placeholder="Hello, \nThis is multiline example \n\nHave Fun" rows="5" cols="35"></textarea>
© www.soinside.com 2019 - 2024. All rights reserved.