The textbox in question is in nested datalist so i did it this way yet didn’t work, am i missing something, on default the textbox will be hidden, but when i click the button it’s visible, there is no need for clicking hid button.
<script type="text/javascript">
$(function () {
$("[id*=GetUSERCOMMENTS2] [id*=txtcommentpost]").each(function () {
$('#lnkbtnComment').on("click", function () {
$('#txtcommentpost').attr('style', 'display: block;');
return false;
});
});
});
</script>
<asp:DataList ID="GetUSERPOSTS" runat="server" OnItemDataBound="GetUSERCOMMENTS2_ItemDataBound"
Width="100%">
<ItemTemplate>
<asp:LinkButton ID="lnkbtnComment" runat="server" Font-Size="20px" CssClass="fa fa-comments-o">
</asp:LinkButton>
<asp:DataList ID="GetUSERCOMMENTS2" runat="server" OnItemDataBound="GetUSERCOMMENTS2_ItemDataBound"
Width="100%">
<ItemTemplate>
<div class="media-left" style="">
</div>
<article class="timeline-entry">
<div class="timeline-entry-inner">
<div class="timeline-icon bg-warning " style="">
<i class="entypo-feather">
<a class="" href='<%#getUserHREF1(Container.DataItem)%>' >
<asp:Image ID="lblFImageName" runat="server" src='<%#getSRCcomment(Container.DataItem)%>' Width="35px" Height="35px" CssClass="img-circle animated fadeInDown"/>
</a>
</i>
</div>
<div class="timeline-label">
<h2 style="margin-bottom:2px"><a href="#" style=" margin-bottom:2px">
<asp:Label ID="lblfname" Text='<%#Eval("Name") %>' CssClass="" runat="server" Font-Bold="True" Font-Names="Arial" ForeColor="Black" Font-Size="Smaller" />
<asp:Label ID="lblUserNamecom" Text='<%#Eval("UserName") %>' CssClass="" runat="server" Font-Bold="True" Font-Names="Arial" ForeColor="Gray" Font-Size="Smaller" />
</a>
<small>
<asp:Label ID="FavouriteID" Style="display: none;" runat="server" />
<asp:Label ID="lblDate" Text='<%#Eval("Senddate") %>' runat="server" CssClass="" Font-Bold="True" Font-Names="Arial" ForeColor="Black" Font-Size="Smaller" />
</small>
</h2>
<span>
<asp:Label ID="LBLCOM" runat="server" Text='<%#Eval("CommentID") %>' Visible="false" />
<asp:Label ID="lblComments2" runat="server" Text='<%#Eval("Comments") %>' ForeColor="#333333" CssClass="" Font-Names="Arial" Font-Size="Smaller" Font-Bold="False" />
</span>
<p class="media-body " style=" ">
<div class="clearfix"/>
<div class="" style=""/>
<span class="" style="margin-right:22px">
<asp:LinkButton ID="btnlikcomment" runat="server" CssClass="fa fa-star-o" ForeColor="Silver">
<span class="" style="">
<asp:Label ID="Label32" runat="server" Text="7 " Font-Size="Smaller" ForeColor="Gray"></asp:Label>
</span>
</asp:LinkButton></span><span class="" style="margin-right:6px">
//here is the button that displayes the textbox
<asp:LinkButton ID="btnIncomm" runat="server" CssClass=" fa fa-comment-o" ForeColor="Silver">
<span class="" style="">
<asp:Label ID="Label30" runat="server" Text="12 " Font-Size="Smaller" ForeColor="Gray"></asp:Label>
</span>
</asp:LinkButton>
</span><span class=" text-left" style="margin-top:6px"><span class=" pull-right"><asp:LinkButton ID="LinkButton8" runat="server" ForeColor="#B0B0B0">
<span class="" style="margin-right:8px">
<asp:Label ID="Label29" runat="server" Text="" CssClass=" glyphicon glyphicon-eye-open" ForeColor="#B0B0B0" Font-Size="Smaller"></asp:Label>
</span>
</asp:LinkButton></span></span></p><div class="clearfix"></div>
<asp:Panel ID="Panel1" runat="server" class=" commentpost">
<div class="" style="margin-top:6px; margin-bottom:8px">
<div class="" id="dvtxtcommentpost">
<asp:TextBox ID="txtcommentpost" runat="server" rows="1" cols="20" CssClass=" form-control" placeholder="Reply to this comment..." AutoPostBack="true" OnTextChanged="OnTextChanged" MaxLength="500"></asp:TextBox>
<asp:Label ID="Label36" runat="server" Text="Hit Enter after typing " Font-Size="X-Small" ForeColor="Gray"></asp:Label>
<div class="text-right" style="margin-bottom:2px; margin-right:12px">
<asp:Label ID="lblcommetcount1" runat="server" ></asp:Label>
</div>
</div>
</div>
</asp:Panel><div class="clearfix"></div>
<asp:Panel ID="Pnlcomment" runat="server">
<asp:DataList ID="GetUSERCOMMENTS3" runat="server" >
<ItemTemplate>
<div class="media-left" style="margin-top:2px">
<a class="timeline-item" href='<%#getUserHREF1(Container.DataItem)%>' >
<img src='<%#getSRCcomment2(Container.DataItem)%>' class=" img-circle animated fadeInDown"
style="width:25px; height:25px;" />
<asp:Label ID="Label69" runat="server" Text="|" Font-Size="X-Large" ForeColor="#0099CC"></asp:Label></a></div><div class="media-body " style=" ">
<asp:Label ID="lblnestname" Text='<%#Eval("Name") %>' CssClass="" runat="server" Font-Bold="True" Font-Names="Arial" ForeColor="Black" Font-Size="Smaller" />
<asp:Label ID="lblshId" Text='<%#Eval("UserName") %>' CssClass="" runat="server" Font-Bold="True" Font-Names="Arial" ForeColor="Gray" Font-Size="Smaller" />
<asp:Label ID="Commentnest" runat="server" Text='<%# Eval("CommentID") %>' Visible="False"></asp:Label><br /><asp:Label ID="lblcomment" runat="server" Text='<%#Eval("Comments") %>' ForeColor="#333333" CssClass="" Font-Names="Arial" Font-Size="Smaller" Font-Bold="False" />
<div class="clearfix"/>
<div class="" style="margin-top:6px"/>
<span class="" style="margin-right:22px">
<asp:LinkButton ID="LinkButton4" runat="server" CssClass="fa fa-star-o" ForeColor="Silver">
<span class="" style="">
<asp:Label ID="Label32" runat="server" Text="7 " Font-Size="Smaller" ForeColor="Gray"></asp:Label>
</span>
</asp:LinkButton></span><span class="" style="margin-right:22px"><asp:LinkButton ID="LinkButton6" runat="server" CssClass=" glyphicon glyphicon-share-alt" ForeColor="Silver"> </asp:LinkButton></span><span class="" style="margin-right:6px"><asp:LinkButton ID="LinkButton7" runat="server" CssClass=" fa fa-comment-o" ForeColor="Silver">
<span class="" style="">
<asp:Label ID="Label30" runat="server" Text="12 " Font-Size="Smaller" ForeColor="Gray"></asp:Label>
</span>
</asp:LinkButton></span><span class=" text-left" style="margin-top:6px"><span class=" pull-right"><asp:LinkButton ID="LinkButton8" runat="server" ForeColor="#B0B0B0">
<span class="" style="margin-right:8px">
<asp:Label ID="Label29" runat="server" Text="" CssClass=" glyphicon glyphicon-eye-open" ForeColor="#B0B0B0" Font-Size="Smaller"></asp:Label>
</span>
</asp:LinkButton></span></span></div><div class="clearfix"></div>
<div class="" style="margin-top:6px; margin-bottom:8px">
<asp:TextBox ID="txtcommentpost2" runat="server" CssClass="commentpost2 form-control" placeholder="Reply to this comment..." AutoPostBack="true" OnTextChanged="OnTextChanged"></asp:TextBox><div class="pull-right">
<div class="text-right" style="margin-bottom:2px; margin-right:12px">
<asp:Label ID="lblcommetcount2" runat="server" Text=""></asp:Label></div></div></div><div class="clearfix"></div>
<div class="" style="margin-top:4px; margin-bottom:4px"></div>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
</div>
</div>
</article>
</ItemTemplate>
</asp:DataList>
</ContentTemplate> </asp:UpdatePanel>
</ItemTemplate>
</asp:DataList>