MyBB Community Forums

Full Version: headinclude javascript gives PHP error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
when including this javascript in headerinclude:
function CloseAlert()
{walert=document.getElementById('walert');$(walert).fadeTo('slow',0.0,function(){$(walert).remove();});}

I get a PHP error: Parse error: syntax error, unexpected '(', expecting T_VARIABLE or '$' in /home/studio/public_html/global.php(436) : eval()'d code on line 23

This is a working JQuery Javascript. How can it cause a PHP error??

edit: never mind. Obviously it's because it tries to parse the {$ as if it was a variable. Inserting a space fixes the problem.