javascript - Show/Hide onClick button not working -
hey guys have searched many answers , none of them seem working going put code here , can me figure out.
i going have 2 buttons. first button (show_chappie) going show hidden contents , button (hide_chappie) , hides self when clicked.
the second button (hide_chappie) going hide contents , bring first button (show_chappie). hide_chappie button hidden.
the information div hidden start. did on css using display:none;
here's html code far:
<button class ="show_chappie" onclick="showinfo()">show more</button> <div class="info">info here.</div> <button class ="hide_chappie" onclick="hideinfo()">show less</button>
here's javascript code far:
function showinfo(){ document.getelementbyid('chappie_info').style.display = "inline-block"; document.getelementbyid('show_chappie').style.display = "none"; document.getelementbyid('hide_chappie').style.display = "inline-block"; }
i haven't written code hide_chappie button because wanted see working first.
so have gone wrong here? in advance.
you trying elements id
while have class
, should change elements class
id
this:
<button id="show_chappie" onclick="showinfo()">show more</button> <div id="info">info here.</div> <button id="hide_chappie" onclick="hideinfo()">show less</button>
Comments
Post a Comment