0
JavaScript
Hey guys... I need a javaScript function which help me after clicking a button pops up a box or prompt box saying" please enter your comment" and after submitting that, shows that comment, i want this action continues for other comments. Please help!!!
2 Answers
+ 3
Shqyq Hp
Can you show what have you tried
+ 1
Nilesh đźđł yea of course here is my try.
but thats NOT what i wanted!
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">click here</button>
<p id="demo"></p>
<script>
function myFunction() {
var txt;
var comment = prompt("please enter your comment");
if (comment == null || comment == "") {
txt = "no comment";
} else {
txt = comment;
}
document.write(txt);
}
</script>
</body>
</html>