locked
how to get the id of textbox inside a gridview using jquery? i'm also using master in asp.net RRS feed

  • Question

  • User102588659 posted

    how to  get the id of textbox inside a gridview using jquery? i'm also using master in asp.net

    Tuesday, August 9, 2016 9:56 AM

Answers

  • User61956409 posted

    Hi asmasm,

    You could refer to the following sample code to pass current object to your JavaScript function, and then you could use .attr() method to get id attribute of current object.

    <asp:TextBox ID="txtfield1" runat="server" onblur="getcurrenttxtid(this)"></asp:TextBox>
    function getcurrenttxtid(obj) {
        var id = $(obj).attr("id");
        alert(id);
    }
    

    Best Regards,

    Fei Han



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 10, 2016 9:52 AM