Javascript Objects Working In Html But Not Php
Solution 1:
If the HTML is right and the javascript is right and is loaded then it makes no difference whether the HTML came from a static file or was generated with PHP. The browser still sees it as just HTML (the PHP is server-side so the browser never sees that) and it is in the browser that the javascript runs.
Which leaves us with the following possibilities:
- THe HTML generated via PHP is different in some way (I know you say it isn't, but double check)
- The javascript file is not being loaded the second time
THis is assuming you are loading a whole page generated with PHP - if you start adding bits ysing ajax requests then the situation changes as you tab code is set up in document ready and only sees the page as it is then.
Solution 2:
Simple answer.
Any ideas why this would work when using HTML only but not when put inside a PHP function?
They both are very different. While Javascript is client side coding, PHP is server-side coding.
You should really understand the difference between them. Also the syntax differs.
Post a Comment for "Javascript Objects Working In Html But Not Php"