• 0
Sign in to follow this  
Followers 0

hide media box with button click

Question

Posted · Report post

I have a media box with a class name of media_image" which I want to clock when I button is clicked.  I found a script that does it and implemented this script

 

<script type="text/javascript" language="javascript">// <![CDATA[
function showHide() {
    var ele = document.getElementsByClassName("main_image")[0];
    if(ele.style.display == "block") {
            ele.style.display = "none";
      }
    else {
        ele.style.display = "block";
    }
}
// ]]></script>
I then created a button to with this code 
 
<form action="" method="post">
<input onclick="return showHide();" type="button" value="Show-Hide" /></form>

but it is not closing the media box.  Any suggestions would be helpful.

 

Share this post


Link to post
Share on other sites

1 answer to this question

  • 0

Posted · Report post

Hi,

 

Not sure what you mean by clock and close. Are you saying that when the button in the mediabox is clicked you want the whole media box to hide or close. If you mean close, how do you want it to close ?

The MediaBox isn't an accordion, or have I completely misunderstood what you're trying to achieve lol ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0