I have a JavaScript function that populates and shows a div when a user hovers over something. I've found out that if the input that I pass to the function contains a blank line, it won't work. Is there an easy way to encode my variables in PHP so it can pass safely?
Javascript:
function showPlay(id, info)
{
var playID = "my_play_div" + id;
var snippetID = "post_snippet" + id;
document.getElementById(playID).style.visibility="visible";
document.getElementById(snippetID).innerHTML = info;
}
I've tried using $info = htmlentities($info); on my content and $info = mysql_real_escape_string($info); but neither of these got rid of the blank lines, just the quotes (which I need to get rid of as well).
Anyone have a better solution?
$infogetting into the Javascript variableinfo?