I am facing an issue where I want to open a div when clicking on the anchor tag inside the data-list control. I tried searching for a solution on Google, but it doesn't seem to work as expected (the div does not open when I click on the anchor tag). I am curious to know why.
$( function () {
$('a.detials').on('click', function (ev) {
$(this).next('div').toggle();
});
});
<asp:DataList ID="dtlRoomsPrice" Visible="false" orizontalAlign="center" runat="server" ShowFooter="False" ShowHeader="False" Width="700px" OnItemDataBound="dtlRoomsDetails_ItemDataBound">
<ItemTemplate>
<a href="javascript:void(0);" class="detials">ShowDetails</a>
<div class="shoow" id="div_ID" style="width:687px;background-color: rgb(247, 239, 216);border-radius: 5px;box-shadow: 7px 6px 5px #888888; border: 2px solid gray; display:none;padding: 5px; ">
<asp:Label ID="lblAmiintiesTxt" runat="Server" CssClass="shbe_label" Text="<%$ Resources:Resource,Amenities %>" Visible="false"></asp:Label>
<p style="margin-top: 0px;margin-bottom: 0px;font-family: sans-serif; font-weight: bold; font-size: small;">Amenities</p>
<asp:Label ID="lblAmiinties" runat="Server" CssClass="shbe_h2" Text='<%# Eval("Amenities") %>' Visible="true"></asp:Label>
<br />
<asp:Label ID="lblCanclText" Width="130" runat="server" CssClass="shbe_label" Visible="false" Text="<%$ Resources:Resource, Payment and Cancellation policy %>"></asp:Label>
<p style="margin-bottom: 0px;font-family: sans-serif; font-weight: bold; font-size: small;">CancellationPolicy</p>
<asp:Label ID="lblCancelation" runat="Server" CssClass="shbe_h2" Text='<%# Eval("CancellationPolicyText") %>' Visible="true"></asp:Label>
</div>
</ItemTemplate>
</asp:DataList>