javascript - How can I change the css property display to block from PHP code -


i'm trying set form validation contact page, , have set if there nothing in of input boxes won't send e-mail. want show hidden div have displays "please fill in boxes". code have,

echo "         <script type=\"text/javascript\">             document.getelementbyid('notvalid').style.display = 'block';         </script>     "; 

after use header refresh page. default css rule #notvalid set display: none; have been doing lot of research, , can't seem figure out.

while cristyan has solution, don't think need wait dom content load(downloading of images , other non html content files), can execute js html finished loading:

echo "<script type=\"text/javascript\">         window.onload = function() {           document.getelementbyid('notvalid').style.display = 'block';         };       </script>"; 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -