A JQuery Sample
satya - Thursday, July 15, 2010 2:27:36 PM
Using jquery context and jquery function example
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script>
function onl()
{
alert('hello');
gety();
}
function getx()
{
alert($("#my_div_id > #ape").html());
}
function gety()
{
//get children of my_div_id
//whose class is "detail"
//print out the detail
elemArray = $("#my_div_id > .detail");
alert(elemArray.length);
for (i=0;i<elemArray.length;i++)
{
myobj = $(elemArray[i]).find(".ape");
alert(myobj.html());
}
}
</script>
</head>
<body onload="onl()">
<p>Hello
<div id="my_div_id">
<div class="detail">
<span class="ape" style="visibility:hidden">
answer="yes"
</span>
<p>Detail 1
</div>
<div class="detail">
<span class="ape" style="visibility:hidden">
answer="yes"
</span>
<p>Detail 2
</div>
</div>
</body>
</html>