Hello I have a php code which by echo calls the javascript function expand(txt) with the parameter ‘txt’
echo "<div onclick=javascript:expand('$hint1')>$valueX</div>";
function expand(txt)
{
document.getElementById("targetDiv").value=txt;
}
my problem is that this script works only if the ‘$hint1’ is a string without white space, example if $hint=”car” everything works but if $hint=”red car” the javascript is not working.
Any help would be much appreciated! Thanks!
change this line:
to this:
the onclick-event has to be in “” and you don’t need the javascript:-label (but the last one shouldn’t make a difference, it’s just senseless)