I have a .hta File containing JavaScript and HTML. My JavaScript Code modifies the HTML with functions like "appendChild", but the HTML does not get updated afterwards; Even if the element was corretly appended in the DOM-Structure (I can alert the .innerHTML, returning the html-code like it should be, but it doesn't show in the browser). If put in an HTML-File, it works completely fine.
<!DOCTYPE html>
<html>
<head>
<hta:application id="prjreq_v1" applicationname="ProjectRequirements">
<script>
function appendDiv(){
//Get the element that will get appended
var contentElement = document.getElementById("main_table");
//Create table row
var tr = document.createElement("tr");
tr.id = 0;
//Create table column
var td_0 = document.createElement("td");
td_0.id = "date";
td_0.innerText = "22/22/2222";
//Append
tr.appendChild(td_0);
contentElement.appendChild(tr);
//Alert outputs the modified HTML, but it doesn't show...
alert(contentElement.innerHTML);
}
</script>
</head>
<body>
<div id="content">
<table id="main_table">
<tr>
<th id="date">Date</th>
<th id="source">Source</th>
<th id="requirement">Description</th>
</tr>
<tr id="100">
<td id="date">dd/MM/yyyy</td>
<td id="source">Example1 Source</td>
<td id="requirement">Lorem Ipsum dolores est</td>
</tr>
</table>
</div>
<script>(function (){appendDiv();})();</script>
</body>
</html>