I have the following code in PHP and it doesn't work:
echo "<script language=\"javascript\">
function rebuild_preview(){
var Title = document.getElementById('title').value;
var LYTtitle = document.getElementById('lyt_title');
if (LYTtitle !== null){
document.getElementById('lyt_title').innerHTML = Title.replace(/\r?\n/g, '<br />');
}
}
</script>";
I think it is because of the quotes in the Title.replace section. Does someone know the correct way to handle it?