<example>
	<comment>This example is being used on http://dmitriid.com/jquery</comment>
	<script exec="post">
		<![CDATA[
			 $("#wrapper > li").each(
				function(index){
					var obj = $(this);
					obj
						.find("h2")
						.css(
							{
							backgroundColor: index % 2 == 0 ? "#ef0000" : "#0000ef",
							cursor: "hand",
							cursor: "pointer",
							color: "#FFF"
							}
						)
						.click(
							function(){
								obj.find("p").toggle();
							}									
						)
						.end()
						.find("p").hide();
				}						
			);
		]]>
	</script>
	
	<css src="css/1.css" />
	
	<data>
		<item type="description">
			<![CDATA[
				 <strong>Victor Kondratyuk(<a href="http://www.worldofmoldova.com/">World of Moldova</a>), Klaus Hartl, Kenneth</strong>
				 <br /><br />
				 <div>
					 We have some articles with headers
					 <br />
					 <ol>
						 <li>We want bodies of these articles to be hidden on page load.</li>
						 <li>We want to toggle the visibility of these articles by clicking on the headers. </li>
						 <li>We also want to color odd and even headers differently. </li>
						 <li>And we want the page to be indexed by search engines.</li>

					 </ol>
				 </div>
				 <div>
					 Document structure: 
					 <pre>
&lt;ul id="wrapper">
	&lt;li>
		&lt;h2>Title 1&lt;/h2>
		&lt;p>Body 1&lt;/p>
	&lt;/li>
	&lt;li>
		&lt;h2>Title 2&lt;/h2>
		&lt;p>Body 2&lt;/p>
	&lt;/li>
	&lt;li>
		&lt;h2>Title 3&lt;/h2>
		&lt;p>Body 3&lt;/p>
	&lt;/li>
&lt;/ul>
					 </pre>
				 </div>
				 <div>
					 Javascript: 
					 <pre>
&lt;script language="Javascript" type="text/javascript">
						 
						 // Run through all li's that are children of the element with  id="wrapper"
	
	$("#wrapper > li").each(
		function(index){
			var obj = $(this);
			
			// Find all h2 elements, set their CSS properties and the onclick function
			// After that hide all P elements
			
			// Instead of using the css method we could have used
			// addClass(index % 2 == 0 ? "even" : "odd")
			// had we had CSS classes "even" and "odd"	
			
			obj
				.find("h2")
				.css(
					{
						backgroundColor: index % 2 == 0 ? "#ef0000" : "#0000ef",
						cursor: "hand",
						cursor: "pointer",
						color: "#FFF"
					}
				)
				.click(
					function(){
						obj.find("p").toggle();
					}									
				)
				.end()
				.find("p").hide();
		}						
	);
&lt;/script>
					</pre>
				</div>
			]]>
		</item>
		<item type="demo">
			<![CDATA[
				<ul id="wrapper">
					<li>
						<h2>Title 1</h2>
						<p>Body 1</p>
					</li>
					<li>
						<h2>Title 2</h2>
						<p>Body 2</p>
					</li>
					<li>
						<h2>Title 3</h2>
						<p>Body 3</p>
					</li>
				</ul>
			]]>
		</item>
		<item type="alternative">
			<![CDATA[
				 <strong>R. Rajesh Jeba Anbiah</strong>
				 <br /><br />
				 Hide all P elements. Assign onclick to headers. 
				 <div>
					 Javascript: 
					 <pre>
&lt;script language="Javascript" type="text/javascript">
	$(document).ready(function() {
		$("#wrapper p").hide(); //hide initially
		$("#wrapper h2").click (function() {
			$("p", $(this).parent()).slideToggle("slow");
		});
	});
&lt;/script>
					</pre>
				 <br /><br />
				 What happens in the click method? We find element P in the parent element of h2:
				 <br /><pre>
$(<br />
	"p",              // what
	$(this).parent()  // where
);
</pre>
				</div>
			]]>
		</item>
		<item type="alternative">
			<![CDATA[
				 <strong>Karl Swedberg</strong>
				 <br /><br />
				 Same as the previous alternative except: 
				 <div>
					 Javascript: 
					 <pre>
&lt;script language="Javascript" type="text/javascript">
	$(document).ready(function() {
		$("#wrapper p").hide(); //hide initially
		$("#wrapper h2").click (function() {
			<strong>$(this).siblings('p').slideToggle('slow');</strong>
		});
	});
&lt;/script>
					</pre>
				</div>
			]]>
		</item>
	</data>
</example>