Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6898749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:20:09+00:00 2026-05-27T07:20:09+00:00

i have html table and add in table row in runtime. i want to

  • 0

i have html table and add in table row in runtime. i want to add to new tr(dynamic tr) add ClickEvent
i write this code, but it’s not work

$(“#GridView1 tbody tr”).click(function (e) {

                var id = $(this).find(".lbl").text();
                workOrderId = id;
                //  $("#gridtbl tr").remove();
                $.ajax({
                    url: "PublicHandler.ashx",
                    contentType: "application/json; charset=utf-8",
                    data: { workOrderId: id },
                    success: function (data) {
                        var grd = $("#gridtbl");
                        $.each(data, function (i, b) {
                            var str = "<tr>";
                            str += "<td style='display: none;'>" + b.WorkId + "</td>";
                            str += "<td>" + b.WorkName + "</td>";
                            str += "<td>" + b.SectionName + "</td>";
                            str += "<td>" + b.SectionSupervisor + "</td>";
                            if (b.RequestCount == null) {
                                str += "<td>" + " " + "</td>";
                            } else {
                                str += "<td>" + b.RequestCount + "</td>";
                            }

                            str += "<td>" + " " + "</td>";

                            str += "</tr>";
                            $(str).click(function () {
                                alert("hiiiiiiiiiii");

                            }).end().appendTo("#gridtbl tr");
                            // grd.append(str);

                        });
                    },
                    dataType: "json"

                });
                popup(e);
            });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:20:10+00:00Added an answer on May 27, 2026 at 7:20 am

    you can use delegate

    $("#GridView1 tbody").delegate("tr", "click", function(e) {
      //rest of the code here
    });
    

    or lately in jquery 1.7 you can use on

    $("#GridView1 tbody").on("click", "tr", function(e){
        //rest of the code here
    });
    

    as mentioned in the comments by @Matt the live method is deprecated to its better not to use but i’ll leave the example intact

      $("#GridView1 tbody tr").live("click",function (e) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a simple html table where i want to delete and add rows
I have an html table followed by a button that says Add Row below
I have an HTML table that looks like this: ------------------------------------------------- |Column 1 |Column 2
I have a HTML table like this: <table border=1> <tbody> <tr> <td><a href=# class=delete>DELETE
I have a HTML table like this: <table border=1> <tbody> <tr> <td><a href=# class=delete>DELETE
I have an html table rendered page and I want to save it as
There is one table that have fields included the add row button. I am
i have this structure of html table: <table id=test> <thead> <tr> <td></td> <td></td> <td></td>
I have a simple working PHP script to write an HTML table from a
I have an HTML table with several rows. If you hover on the row

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.