I have this html block
<div id="pane" class="MosadBoxRight scroll_pane" style="overflow: hidden; height: 590px; width: 250px; padding: 0px 41px 0px 0px;">
<div class="MosadBoxRightKoteretpopUp">text</div>
<div class="area" id="area1">
<a iframe="/4746929" style="cursor:pointer" class="alink" id="aLink">example1
</a></div>
<div class="area" id="area2">
<a iframe="4746929" style="cursor:pointer" class="alink" id="aLink">example1
</a></div>
<div class="area" id="area3">
<a iframe="/474692946" style="cursor:pointer" class="alink" id="aLink">example1
</a></div>
</div>
I have also this javascript function
function nextchapter() {
loc=loc+1;
var contextCmsPage = $("#pane .alink:nth-child(0)").attr("iframe");
}
and a button that call this function
<input type="button" id="btnc" onclick="nextchapter()" value="check" />
I am trying to get nth child of class alink in father Div pane
I getting undefinded for $("#pane .alink:nth-child(0)").attr("iframe");
I also tried
$("#pane").find(".alink:nth-child(0)").attr("iframe");
with same result
What can be the problem?
Thanks
Baaroz
You don’t need the nth child but the nth element of class
alink.Use this :