Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with Javascript + Form Button

    Good afternoon.

    I'm trying to make it so a 'radio button' in a 'form' will 'collapse' a Div that I have hidden.

    I'm using the JavaScript to control the collapse, and google's Jquery for the rest of it.

    here's the code.

    Code:
    <head>
    <script type="text/javascript" src="SpryAssets/collapse.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript">
    animatedcollapse.addDiv('test', 'fade=1, group=test, speed=400')
    
    animatedcollapse.ontoggle=function($, divobj, state) { //fires each time a DIV is expanded/contracted
    		//$: Access to Jquery
    		//divobj: DOM reference to DIV being expanded/collapsed. Use "divobj.id" to get the ID.
    		//state: "block" or "none", depending on the state.
    	}
    	
    	animatedcollapse.init()
    </script>
    </head>
    and the body code...

    Code:
    <form action="myform.php" method="post">
    <a id="collapsable" href="javascript:animatedcollapse.toggle('test')"> [+]
            Testing the Collapsability of this Scripting.</a>
    	<div id="test" style="display:none;">	
        	<h1> You can see that if you toggle the 'Image Display' Button. This will display Properly.</h1>
        </div>
    </form>
    You can find a completely working version (When not using Radio buttons and forms) located at My Toggle Works Here.

    Alternatively, you can find the NON working version, which is what I'm attempting to get to work, located at My Toggle Doesn't Work.

    you can see that in the version that doesn't work, if you hit the 'Radio button', it will collapse, and immediately uncollapse the Div, I don't get why it does this.

    Any help is greatly appreciated.

  • #2
    New Coder
    Join Date
    Jun 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bump?

    No one is able to help?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •