![](/img/trans.png)
[英]How to get selected index from nested array ? Angular - Javascript
[英]How to get ajax accordion selected index from javascript
嗨,我使用過Ajax手風琴。 我需要的是當我點擊關於賬單信息的手風琴選項卡時獲取當前選擇的索引我應該在Javascript或jquery中選擇index = 0
我已將javascript設置為
注意:結算信息是在OPCPanels中設置的類
<script type="text/javascript">
function pageLoad(sender, args) {
$(".billinginformation").click(function (event, ui) {
alert("hi");
alert($(".billinginformation").accordion("option", "active"))
});
}
</script>
HTML代碼
<ajax:Accordion ID="OPCPanels" runat="server" SelectedIndex="0" HeaderCssClass="widget billinginformation" ContentCssClass="content" AutoSize="None">
<Panes>
<ajax:AccordionPane ID="BillingInformation" runat="server" CssClass="widget">
<Header><h2>Billing Information</h2></Header>
<Content>HI</Content>
</ajax:AccordionPane>
<ajax:AccordionPane ID="ShippingInformation" runat="server" CssClass="widget">
<Header>Shipping Information</Header>
<Content>hello</content>
</ajax:AccordionPane>
</Panes>
</ajax:Accordion>
我已將計費信息課程設置為我的主手風琴,點擊任何手風琴我都會收到“hi”的提醒。
但是我應該如何獲得我在JavaScript中選擇的所選索引?
這似乎是ASP.NET Ajax Toolkit手風琴。 嘗試:
$find('OPCPanels').get_SelectedIndex()
編輯:
關於AJAX工具包的文檔不多。 看看你可以從這些鏈接中找到什么。
Accordion SelectedIndex背后的最后一項代碼? http://www.dotnetcurry.com/ShowArticle.aspx?ID=215
不確定html在瀏覽器中的實際效果如何,所以我選擇使用widget類的click元素:編輯:現在使用CssClass
$('#OPCPanels [CssClass="widget"]').click(function (event, ui) {
alert("Index: " + $(this).index() );
});
在http://www.newschool.edu/ajax/Accordion/Accordion.aspx上查看示例代碼( 和源代碼 ),您需要使用
var behavior = $find("<%=OPCPanels.ClientID%>_AccordionExtender");
alert( behavior.get_SelectedIndex() );
您可以查看實際的源代碼以確定accordion擴展器元素的id
是什么。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.