I have posted this question in the old forum but once jQuery moved to Zoho, I've lost my threads so I'm starting my thread over again here.
I have a ASP.NET nested ListView control that repeats a DIV with same ID. How do I use jQuery to apply the behavior to a Div that contains a unique TextBox control ID? Below are my code:
- $("textarea[id$=txtInsertComments]").blur(function()
- {
- $("#commands").hide()
- });
- $("textarea[id$=txtInsertComments]").focus(function()
- {
- //$("#commands").show("normal");
- $(this).next("#commands").show("normal");
- })
And here's what the asp.net code of the DIV:
- <asp:TextBox ID="txtInsertComments" AutoPostBack="false" CssClass="expanding" runat="server"
- Width="406px" Text='<%# Bind("comments") %>' TextMode="MultiLine" />
- <ajaxToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender3" runat="server"
- TargetControlID="txtInsertComments" WatermarkText="Write your comments" WatermarkCssClass="waterMarkText">
- </ajaxToolkit:TextBoxWatermarkExtender>
- <%--This the following div if I figured how to get jQuery to recognize repeating div with same ID --%>
- <div id="commands" style="display: none;">
- <table cellpadding="0" cellspacing="0" width="400px" id="tblCommands">
- <tr>
- <td style="width: 50%; text-align: center;">
- <asp:LinkButton ID="lnbInsertRes" runat="server" CommandName="Insert" Font-Underline="false">Insert</asp:LinkButton>
- </td>
- <td style="width: 50%; text-align: center;">
- <asp:LinkButton ID="lnbCancelRes" runat="server" CommandName="Cancel" Font-Underline="false">Cancel</asp:LinkButton>
- </td>
- </tr>
- </table>
- </div>
The whole code above repeats inside the ListView control. The DIV ID="command" is what I want to apply the jQuery behavior above to but only to the DIV ID="command" that the user clicks on the TextBox ID="txtInsertComments". Any suggestion is much appreciated.