Hello I have a function
Fortune.prototype.entername = function () {
var person = prompt("Please enter your name", "Harry Potter");
if (person != null) {
document.getElementById("demo").innerHTML =
"Hello " + person + "! Check Your Fortune";
};
this.words();
}
I want to call it using button
here is my code <p class="dark" id="demo"><button onclick="this.entername()">Click to Enter Name & see your Fortune</button></p>
However it says this.entername()
is not a function. Silly mistake I dont know how to call it full js code is here https://jsfiddle.net/e9zywrnt/