調用內部中繼器的jquery函數問題我想切換div時單擊linkbutton。我認爲不是第一個jquery函數用於這種情況。 我想也是從div和鏈接按鈕之間的表probelem。調用中繼器內部的jQuery函數
function toggleMe() {
$(function() {
$('.toggler').on('click', function (ev) {
$(this).next('.dataContentSection').toggle();
});
});
}
<div id="repeater"><div class="dataContentSection">
<div>Name</div>
</div>
<table>
<tr>
<td>
<asp:LinkButton class="titleText toggler" OnClientClick="javascript:toggleMe(); return false;" runat="server">+ Address details</asp:LinkButton>
<asp:Label ID="Label1" runat="server" Text="Welcome"></asp:Label>
</td>
</tr>
</table>
<div class="dataContentSection" style="display: none;">
<div>Address Line 1:</div>
<div>Address Line 2:</div>
<div>Address Line 3:</div>
</div>
<div class="dataContentSection">
<div>Name</div>
</div>
<table>
<tr>
<td>
<asp:LinkButton class="titleText toggler" OnClientClick="javascript:toggleMe(); return false;" runat="server">+ Address details</asp:LinkButton>
<asp:Label ID="Label2" runat="server" Text="Welcome"></asp:Label>
</td>
</tr>
</table>
<div class="dataContentSection" style="display: none;">
<div>Address Line 1:</div>
<div>Address Line 2:</div>
<div>Address Line 3:</div>
</div>
<div class="dataContentSection">
<div>Name</div>
</div>
<table>
<tr>
<td>
<asp:LinkButton class="titleText toggler" OnClientClick="javascript:toggleMe(); return false;" runat="server">+ Address details</asp:LinkButton>
<asp:Label ID="Label3" runat="server" Text="Welcome"></asp:Label>
</td>
</tr>
</table>
<div class="dataContentSection" style="display: none;">
<div>Address Line 1:</div>
<div>Address Line 2:</div>
<div>Address Line 3:</div>
</div>
<div class="dataContentSection">
<div>Name</div>
</div>
<table>
<tr>
<td>
<asp:LinkButton class="titleText toggler" OnClientClick="javascript:toggleMe(); return false;" runat="server">+ Address details</asp:LinkButton>
<asp:Label ID="Label4" runat="server" Text="Welcome"></asp:Label>
</td>
</tr>
</table>
<div class="dataContentSection" style="display: none;">
<div>Address Line 1:</div>
<div>Address Line 2:</div>
<div>Address Line 3:</div>
</div>
<div class="dataContentSection">
<div>Name</div>
</div>
<table>
<tr>
<td>
<asp:LinkButton class="titleText toggler" OnClientClick="javascript:toggleMe(); return false;" runat="server">+ Address details</asp:LinkButton>
<asp:Label ID="Label5" runat="server" Text="Welcome"></asp:Label>
</td>
</tr>
</table>
<div class="dataContentSection" style="display: none;">
<div>Address Line 1:</div>
<div>Address Line 2:</div>
<div>Address Line 3:</div>
</div>
</div>
最新問題? – atmd 2015-01-21 08:26:59
那麼你想實現什麼?當我點擊「地址詳情」時,鏈接應該打開?請給我們正確的細節 – BNN 2015-01-21 08:27:34
當我點擊linkbutton打開div。 – boshkash 2015-01-21 08:28:32