私は、div
既存の内部を作成するという非常に基本的な例を試していdiv
ます。
私が使用するとき、それは機能していないようです:
document.getElementbyId('lc').appendChild(element)
しかし、私がこれを行うとうまくいきます:
document.body.appendChild(element)
windows.onload
関数を追加する必要がありますか?それでも動作しませんが!
HTMLコード:
<body>
<input id="filter" type="text" placeholder="Enter your filter text here.." onkeyup = "test()" />
<div id="lc">
</div>
</body>
JSコード:
function test()
{
var element = document.createElement("div");
element.appendChild(document.createTextNode('The man who mistook his wife for a hat'));
document.getElementbyId('lc').appendChild(element);
//document.body.appendChild(element);
}