javascript - Instead of get element by Id. How to get element by class? -


it doesn't seem working, idea went wrong? if use getelementbyid..it works.. not this. please help.

    <script type="text/javascript">     function conceal() {         if (document.getelementsbyclassname('tick').style.display == 'block') {             document.getelementsbyclassname('tick').style.display = 'none';         }     }      </script> 

use jquery class-selector.

<p class="myclass">hello world!</p> 

then

$(".myclass").dowhatever(); 

Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

php - Redirect and hide target URL -