Skip to content
Advertisement

Copy a line with button of a html table with the data from the database

I have the following problem. I have a table where the respective entries are output via the database. Now I want to insert a button in this table where I can copy the respective line with a click. I already have a code that only works with the html heading but unfortunately not with the entries. I would be very grateful for any help or tips.

JavaScript

HTML Table Picture

Advertisement

Answer

In the column where you want the copy button just add a button :

JavaScript

Then add JavaScript code in the page header for the myCopyProc() function

JavaScript

This JavaScript code could also be put in a file in the server . In this case, you include code like this:

JavaScript

Other JavaScript code :

JavaScript

To test if you enter the code you can add a line like :

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement