0

I'm using React with Bootstrap 4, and have a modal with a form which I would like to dismiss on a successful submit. The documentation suggests there is a "dispose" method. I'm trying to implement it in the form's action, like this:

const plotModal = document.getElementById('plotModal'); plotModal.modal('dispose'); 

This doesn't seem to work. What am I missing?

1
  • 1
    Did you try $('#plotModal').modal('dispose'); Commented Dec 26, 2017 at 10:33

1 Answer 1

1

try close function

plotModal.modal('hide') 
Sign up to request clarification or add additional context in comments.

2 Comments

That doesn't workright-but $('#plotModal').modal('hide'); does. What's the vanilla JS equivalent?
If you are using bootstrap with React. I don't recommend to use pure bootstrap library with react.js directly. There are projects which port bootstrap components to react components so that you can use vanilla javascript to manipulate components without jQuery. Example project: reactstrap.github.io

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.