html - Javascript inside php not working -


i have script inside php change display of div when checkbox checked, checkbox location different place script located.

the snippets of code shown below

        if($_post['test'] == 1)         {             echo "<script> document.getelementbyid('seoterm').style.display='block';</script>";} 

i placed above code in head of current page. when $_post['test'] 1, display of div id seoterm still none, instead of block.

what's problem here ?

it might fire in order manipulate dom.

try:

<script> window.onload = function(){     document.getelementbyid('seoterm').style.display='block'; }; </script> 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -