<script>
document.getElementById("comment").innerHTML="<?php echo 'foo bar'; ?>";
</script>
<div id="comment"></div>
This should give the word “foo bar” in the div element,but its not.Do not know where i’m going wrong. Please help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are trying to use the
commentelement :Before it is declared :
And firebug shows the following error :
(source: pascal-martin.fr)
You should :
If you choose the first solution, your code will look like this :
And it will work :
foo barstring will be visile(source: pascal-martin.fr)