How do i make a choice of yes/no in Java script?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 15

How do i make a choice of yes/no in Java script??

I can use the confirm box but it displays ok/cancel and I want yes/no Please tell 🤔🤔

18th Feb 2017, 5:01 AM
Nikhil
Nikhil - avatar
13 Answers
+ 14
@Kaiza46 Thank you it's a good alternative to the prompt box
19th Feb 2017, 11:08 AM
Nikhil
Nikhil - avatar
+ 12
hey moksh makhija can u tell how to do it??
18th Feb 2017, 6:57 AM
Nikhil
Nikhil - avatar
+ 12
help in what?? making a prompt box with yes/no or The yes/no buttons
19th Feb 2017, 11:12 AM
Nikhil
Nikhil - avatar
+ 12
Then how to make a prompt box with yes/no??
19th Feb 2017, 11:14 AM
Nikhil
Nikhil - avatar
+ 12
I will say later on I think by 8 pm
19th Feb 2017, 11:49 AM
Nikhil
Nikhil - avatar
+ 12
I am not able to get the code can u write something by writing your own code
19th Feb 2017, 12:41 PM
Nikhil
Nikhil - avatar
+ 9
use boolean keyword for true or false instead of yes or no hope it helps !!!
29th Mar 2017, 6:02 AM
Saumya
Saumya - avatar
+ 2
You can create two buttons, the first button's value is "yes" and the second button's value is "false". After that, you can use JavaScript and get the value of the button that the user pressed, and then you can make what you want
19th Feb 2017, 11:07 AM
Apple
+ 2
As you wish^^
19th Feb 2017, 11:14 AM
Apple
+ 2
var check = prompt("Yes or no?"); if(check == "yes") { //Write your code } else { //Write your code }
19th Feb 2017, 11:21 AM
Apple
+ 1
You know how to do it? I can help you if you want^^
19th Feb 2017, 11:11 AM
Apple
+ 1
It works?
19th Feb 2017, 11:41 AM
Apple
0
i want learn hack
30th Mar 2017, 12:57 AM
Serbest Zakho
Serbest Zakho - avatar