I have something like this:
td = '<td id = "someId"> Text <input type = "text" name = "someName" value = "someValue" onchange="textChange(' + "someId" + ')"></td>';
var tag = document.createElement("tr");
tag.innerHTML = td;
document.getElementById("mainTable").appendChild(tag);
But the part:
"textChange(' + "someId" + ')"
is wrong because if i want to reference like this:
document.getElementById("someId").name
This is undefined.
How should I do it?
That’s because your
td‘someId’ don’t have the property name.It’s from your
input text.