Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Someone can explain me this code..

Avatar of eddyperu
eddyperuFlag for United States of America asked on
JavaScriptAJAXjQuery
3 Comments1 Solution363 ViewsLast Modified:
Hi,
I found this code somewhere and even though everything is working great I will love to learn what is going on behind the scene

Doe someone over there can explain me step by step what is this code doing?
  I am trying to learn JQuery and there is not better way that test it than trying it.

So please if there is someone out there that will love to share their knowledge... I am willing to listen.
I am a rocky with jquery.

So far I know that this is an Accordion with radio button....thats it!!! how jquery is catching the trigger from the radio button and how doesn't know that which one to catch...


Thank you
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script> 
    
<script type="text/javascript">
    $(function() {
        $('.chartConfiguratorThingy')
			.show()
			.find('.typeOptions>.fieldGroup>input[type=radio]')
				.bind('updateDependencies', function() {
				    if ($(this).is(':checked')) {
				        $(this).next().next(':hidden').slideDown(function() { $(this).find('input,select').removeAttr('disabled'); });
				    }
				    else {
				        $(this).next().next(':visible').slideUp(function() { $(this).find('input,select').attr('disabled', 'disabled'); });
				    }
				})
				.trigger('updateDependencies')
				.click(function() { $('.typeOptions>.fieldGroup>input[type=radio]').trigger('updateDependencies'); })
				.end()
				

    });
</script>    
</head>
<body>
  <form id="form1" runat="server" >
    <div class="chartConfiguratorThingy">	
      <div class="typeOptions">	
				<div class="fieldGroup"> 
					<input type="radio" name="type" id="bar" value="bar" checked="checked" /> 
					<label for="bar" class="radio">Bar</label> 
					<div class="dependencies"> 
						<div class="fieldGroup"> 
							<label for="barMargin">barMargin:</label> 
							<input type="text" name="barMargin" id="barMargin" value="1" /> 
						</div> 
						<div class="fieldGroup"> 
							<label for="barGroupMargin">barGroupMargin:</label> 
							<input type="text" name="barGroupMargin" id="barGroupMargin" value="10" /> 
						</div> 
					</div> 
				</div> 
				<br /><br />
				<div class="fieldGroup"> 
					<input type="radio" name="type" id="line" value="line" /> 
					<label for="line" class="radio">Line</label> 
					<div class="dependencies"> 
						<div class="fieldGroup"> 
							<label for="lineWeight">lineWeight</label> 
							<input type="text" name="lineWeight" id="lineWeight" value="4" /> 
						</div> 
					</div> 
				</div> 

	  </div>
	</div>	
  </form>
</body>
</html>
ASKER CERTIFIED SOLUTION
Avatar of Mark Steggles
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answers