Jump to content

Matija

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Matija

  1. Cool it is working as I want it!

    Can you please help me with one more thing? What if I have multiple rows?

    like this:

        <table>
            <tr style='background-color:darkgray;color:black;'>
            <th>Column A</th>
            <th>Column B</th>
            </tr>
            <tr>
            <tr id="somerow">
            <td id="myInput" >1234</td>
            <td><button onclick="myFunction()">Copy</button></td>
            </tr>
            <tr id="somerow">
            <td id="myInput" >5678</td>
            <td><button onclick="myFunction()">Copy</button></td>
            </tr>
        </table>

     

    With this code it always copies the text in the first row. what do i need to change that the second button copies text 5678?

    Your help is very much appreciated (I'm new to HTML).

    Thank you.

  2. My HTML is like this:

    <!DOCTYPE html>
    <html>
    <body>
    <form action="https://www.w3docs.com/" method="get" target="_blank">
        <table>
            <tr style='background-color:darkgray;color:black;'>
            <th>Column A</th>
            <th>Column B</th>
            </tr>
            <tr>
            <td id="myInput" >1234</td>
            <td><button onclick="copy()">Copy</button></td>",
            </tr>
            <tr>
            <td id="myInput" >5678</td>
            <td><button onclick="copy()">C</button></td>",
            </tr>
        </table>
    </form>
    <script>
    function copy() {
      var copyText = document.getElementById("myInput");
      copyText.select();
      document.execCommand("copy");
      alert("Copied the text: " + copyText.value);
    }
    </script>
    </body>
    </html>

     

    It still doesn't copy the number "1234" in column A when clicking the button Copy in column B. what did I do wrong?

    When clicking the button in the second row I want a number  "5678" to be copied. The web page opens.

     

    Thank you for your help.

    Matija

  3. hi,

    I have a HTML document with a table with more rows

    Example:

    Column A: text123

    Column B: button

     

    When pressing a button in column B, I would like a text in column A to be copied to a clipboard + a certain page to be opened in a new tab (for example: www.google.com).

     

    any suggestions would be appreciated,

    Matija

×
×
  • Create New...