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!!!

16th Aug 2020, 1:22 PM
Shaghayegh
Shaghayegh - avatar
2 Answers
+ 3
Shqyq Hp Can you show what have you tried
16th Aug 2020, 1:26 PM
Nilesh
Nilesh - avatar
+ 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>
16th Aug 2020, 1:33 PM
Shaghayegh
Shaghayegh - avatar