+ 2

I tried many times then aslo I could not found my mistake why my code is not working properly?

Why my modal box os not appear when I click on "Book Now " Button and it need to Disappear when I click outside the modal box. https://code.sololearn.com/W2Fqj2HYb2ST/?ref=app

2nd Dec 2022, 2:16 AM
Pooja Sahoo
Pooja Sahoo - avatar
2 Answers
+ 4
I commented your code and explained what each step are doing, so you can see where you make mistake, your buttons are list not just one button thats why it is not working Check js tab to see working code with explanation, there is also fix for closening modal on any button click but i commented this code, you can uncomment if you need this feature At end if code you have some idea how you can improve design, and user experience. https://code.sololearn.com/WuxU20LB3SjG/?ref=app
2nd Dec 2022, 1:06 PM
PanicS
PanicS - avatar
+ 3
Because it appears in your js code that you also tried to event delegation(line 57). An alternative solution uses event delegation and the dialog element as a modal. https://code.sololearn.com/WRvpDZ2ulgJJ/?ref=app
3rd Dec 2022, 4:57 AM
ODLNT
ODLNT - avatar