[英]Jquery click event of accordion content
Inside my accordion content i have rows of data that are loaded by ajax call.在我的手风琴内容中,我有由 ajax 调用加载的数据行。 I want to capture click of each of these rows separately and get the id from clicked row.我想分别捕获这些行中的每一行的点击并从点击的行中获取 id。 I am able to capture event of click of accordion content.我能够捕获点击手风琴内容的事件。 but i am not able to get it separately for each row.但我无法为每一行单独获取它。
<dl id="accRegion">
<#list abc as xyz>
<dt id="${xyz}"><a class="red">${xyz}</a></dt>
<dd id="${xyz}">
<dl id="dateList" class="Heading">
<#list somelist as element>
<dt id="dateDiv"><a id="${element}" class="orange">${element}</a></dt>
</#list>
</dl>
</dd>
</#list>
this works这行得通
$("#accRegion dd").click(function(){});
but if i try something like below it doesnt work但如果我尝试类似下面的东西,它就行不通
$("#accRegion dd dt").click(function(){});
I am not sure whats wrong with this.我不确定这有什么问题。 Appreciate any pointers on this.感谢对此的任何指示。
As rows are created dynamically, I guess that you should use this:由于行是动态创建的,我想你应该使用这个:
$("#accRegion dd dt").live('click', function() {
// your code here
});
$(document).on('click',"#ur_id/class", function() {
// your code here
});
You're closing your <dt>
with a </div>
你正在用</div>
关闭你的<dt>
>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.