In my program i have un-ordereded lists which has ordered lists.Requirement is like on clicking the un-ordered list element the child ordered list should open up:
Below is the code that i have written:
<html>
<head>
<title>The jQuery Example</title>
<script type="text/javascript" src="E:\development\JSPProject\jquery-2.1.4.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$(".GChild").hide();
$(".child").click(function()
{
$(".GChild").show();}
);
})
</script>
</head>
<body>
<h3>Welcome </h3>
<div>
<ul class="parent">
<li class ="child">Numbers
<ol><li class="GChild">one</li><li class="GChild">two</li></ol>
<li class ="child">Alphabets<ol><li class="GChild">A</li><li class="GChild">B</li></ol></li></ul>
</div></body>
</html>
so here when i click on Numbers the other list also shows up.I know that i didnt specify anything specific to that list.I tried adding this line
$(this).filter(".GChild").show();
instead of
$(".GChild").show();
But it didn't work.I am new to JQuery so please don't mind if it is silly Question.Is there any way i can achieve "Clicking on (Numbers) it should display One, and Two--------In the same way Alpha-->A,B