I have a whitespace issue, when I echo something from the database into a textarea it adds some whitespaces.
when I use trim() it only removes the whitespaces at the beginning but there are still some left. I just can’t wrap my head around it.
echo trim("[quote=".name($msg['naam'])."]\n".$msg['bericht']."[/quote]\n");
I load the quoted message with jQuery like this
function quoteMessage(pid){
$("#post2").addClass("click");
$(".label").addClass("hidden");
$.post('/action-handler.php', { action: 'quote_message', pid: pid}, function(response) {
if(response != 'ERR'){
$('#post2').val($('#post2').val()+response);
} else {
$('#response').css('display', 'block');
$("#response").append("<p class='good display-error'>An unexpected error occurred.</p>");
}
});
}
For sure, your html code is like this :
Then you have white space inside your textarea. You should write:
See a live example here.