I have made a simple fiddle where I want to call a function on keyup event, but I get function not defined. What is wrong with this code: Html:
<input type="text" id="fname" onkeyup="myFunction()">
Script:
function myFunction() {
var input = document.getElementById("fname");
var para = document.createElement("p");
var node = document.createTextNode("This is new.");
para.appendChild(node);
if (input.value < 3){
input.appendChild(para);
}
}