I want to make a feedback button and I have made the code for the same but it is not working. Below, I have attached parts of my code which are JS codes. I am new here and I am also a little new to HTML so in simple language I want the updated code :)
I have added the whole code below - I don't find any problem with the code. If I run my code the output is almost correct except when I click on the button and write something in the prompt box and click ok, no text appears!
<button id= "Feedback"onclick="MyFunction()">Feedback Form</button>
<p id = "demo"></p>
<script>
function MyFunction(){
var feedback= prompt("Hi! Put all your comments here, we would love to hear you :)", "good")
var msg;
if(feedback=="good"){
msg="I am happy to hear that! Enjoy Watching!";
document.getElementById("demo").innerHTML=msg;
}
else if(feedback=="informative"){
msg="That is fantastic, a total video based encyclopedia, Enjoy Watching! ";
document.getElementById("demo").innerHTML=msg;
}
else if(feedback=="funny"){
msg="Same here! Even I laughed a lot, Enjoy Watching!";
document.getElementById("demo").innerHTML=msg;
}
else if(feedback=="motivational"){
msg="That is superb, Enjoy Watching!";
document.getElementById("demo").innerHTML=msg;
}
else if(feedback=="happy"){
msg= "I am so glad you liked it, Enjoy Watching!";
document.getElementById("demo").innerHTML=msg;
}
else{
msg="We will surely look into it!";
document.getElementById("demo").innerHTML=msg;
}
}
</script>
THIS QUESTION HAS BEEN ANSWERED!