Avatar of eddyperu
eddyperu
Flag for United States of America asked on

Someone can explain me this code..

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>

Open in new window

jQueryJavaScriptAJAX

Avatar of undefined
Last Comment
eddyperu

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mark Steggles

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Mangagm

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
eddyperu

ASKER
Thanks
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy