How do I add an extra html table row upon button click using jQuery?

后端 未结 3 1289
广开言路
广开言路 2020-12-28 20:01

I have the following:

<         
3条回答
  •  遥遥无期
    2020-12-28 20:39

    Give an id to your table, suppose my_table and an id to the anchor a suppose my_button then try the below:

    Your modified code:

author\'s first nameauthor\'s last name
author's first nameauthor's last name
Add Author

And add the below script after including the jquery library in your page.

$(document).ready(function()
{
  new_row="";
  $("#my_button").click(function()
  {    
    $("#my_table").append(new_row);
    return false;

  }
}

提交回复
热议问题