Jump to content

php in external javascript SOLVED with thanks


niche
 Share

Recommended Posts

this line produces a parse error according to my developer tool.

echo 'var div = document.getElementById('subcat');';

I think it's the dot that's the problem. what's the notation for this situation please?

Edited by niche
Link to comment
Share on other sites

best would be

  echo "var div = document.getElementById('subcat');";

for better readibilty. escaping makes it messy and harder to read.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...