Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

JavaScript - Adding user input text field to a th/td element

$
0
0

Problem definition

I am trying to add a new feature in an old JS application. Specifically, I am trying to include a user input textbox that interacts with the other columns.

Current design

Image

    var th = document.createElement('th');
    th.className = "antal";
    var text = document.createTextNode("Antal");
    th.appendChild(text);
    row.appendChild(th);

    var th = document.createElement('th');
    th.className = "Timer";
    var text = document.createTextNode("Timer");
    th.appendChild(text);
    row.appendChild(th);

    var th = document.createElement('th');
    th.className = "antal";
    th.id = "digit_fast_header"
    var text = document.createTextNode("Fastansatte");
    th.appendChild(text);
    th.style.display = "none";
    row.appendChild(th);

My goal To add 1 more column named eksInput which should contain/generate td elements with user input

EDIT

I was looking through documentation for user input on w3schools, and my attempt is the following, though it doesn't follow the design of any of the other columns, and doesn't work.

    var manualInput = document.createElement("INPUT");
    manualInput.setAttribute("text", "input");

Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>