in my website i have page with 2 listview's, each listview contain multiple div's and for each div i implement click event so i can change style to the chosen div but this changes occur to both of the listviews how can i make sure that when div is clicked only the parent listview will be affected? Here is my code:
<asp:ListView ID="ListView1" runat="server">
<LayoutTemplate>
<div id="itemPlaceholder" runat="server"></div>
</LayoutTemplate>
<ItemTemplate>
<div class="box" runat="server"></div>
<div class="selectedBox" runat="server"></div>
<div class="box" runat="server"></div>
<div class="box" runat="server"></div>
</ItemTemplate>
</asp:ListView>
<asp:ListView ID="ListView2" runat="server">
<LayoutTemplate>
<div id="itemPlaceholder" runat="server"></div>
</LayoutTemplate>
<ItemTemplate>
<div class="box" runat="server"></div>
<div class="selectedBox" runat="server"></div>
<div class="box" runat="server"></div>
<div class="box" runat="server"></div>
</ItemTemplate>
</asp:ListView>
<script type="text/javascript">
$(".box").click(function () {
$(this).siblings().removeClass("selectedBox");
$(this).addClass("selectedBox");
});
</script>