JSFiddle - React, Tailwind, and code Playground
HTML
<textarea class="placeholder"></textarea>
<textarea class="placeholder"></textarea>
CSS
textarea{
width:300px;
height:100px;
color:black;
}
textarea.placeholder{
color:gray;
}
JavaScript
var placeholder = 'This is a line \nthis should be a new line';
$('textarea.placeholder').attr('value', placeholder);
$('textarea').focus(function(){
if($(this).val() === placeholder){
$(this).val('')
.removeClass('placeholder');
}
});
$('textarea').blur(function(){
if($(this).val() ===''){
$(this).val(placeholder)
.addClass('placeholder');
}
});