I want to have a div
containing a link. When clicked, the link should be replaced by <input type="text">
, but it just doesn't work.
Any other html code works, but for some reason I can not replace the link with an input:
function working() {
document.getElementById("working").innerHTML = "<h1>Test</h1>";
};
function notworking() {
document.getElementById("notworking").innerHTML = "<input type="text">";
};
<div id="working">
<a onclick="working();" href="#">This works!</a>
</div>
<div id="notworking">
<a onclick="notworking();" href="#">This doesn't!</a>
</div>
<p>
Notice that the entire code doesn't work unless you comment out the "notworking()" function!
</p>