Why not removed the class in the script?

Good evening.

Dismantled Modal in Bootstrap and I want to do the following:

When you click on a specific button, show only(!) need input.

Ie pressing the button DRIVER to display all input's with class-om .driver
It kind of did, if awry, and can be done in beauty :) please correct )
But if to send the form or close, these input-you need to hide, ie to remove the added class

In General, please see example https://codepen.io/pawlek/pen/bjggWe and I think you all will become clear )

Thanks for the help!
June 3rd 19 at 19:23
1 answer
June 3rd 19 at 19:25
Solution
Error you have here is several:
  • Closure of the dialogue can happen not only by clicking on the button in the footer, but by clicking on the overlay and the button in the upper right corner - these cases you can not handle
  • Close handler you assign each time you open the dialogue, i.e., dialogue was opened 10 times - the button will have 10 handlers
  • Trying to remove the class, for some reason, you indicate a point in the beginning of his name

A corrected version might look so.
Thanks for the analysis of errors! Learn JavaScriptu trial), and your code will take note.

But the question) I have your option constantly reloads the page on codepen ) this may be a bug in the code? - Jewell.Koss24 commented on June 3rd 19 at 19:28
don't know what it could be. Itself with such faced... sometimes when using Firefox. But since I use Chrome mostly, never wondered why. - favian_Torp12 commented on June 3rd 19 at 19:31
here I have in Chrome is) first saw. Sleeping on the bugs in macOS Mojave. Now in Chrome and checkboxes are not present :) - Jewell.Koss24 commented on June 3rd 19 at 19:34

Find more questions by tags JavaScriptjQuery