ApathyBear
ApathyBear

Reputation: 9595

Close modal with jquery when submit/onclick is pressed

I have a huge bootstrap modal.

<div className="add-date">
    <div className="modal" id="eventSelectedModal" tabIndex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
        <div className="modal-dialog" role="document">
            <div className="modal-content">
                <div className="modal-header">
                    ....

I want it to close at the end of a function. So on submit I do:

$('#eventSelectedModal"').modal({show: false});

This doesn't seem to close the modal for some reason. Why?

Upvotes: 0

Views: 45

Answers (2)

Christian
Christian

Reputation: 372

Try

$('#eventSelectedModal').modal('toggle');

Or better yet

$('#eventSelectedModal').modal('hide');

Upvotes: 2

user3295436
user3295436

Reputation: 1046

Believe you put an extra ' " ' <--- quote inside your jquery selector.

$('#eventSelectedModal"')

should be

$('#eventSelectedModal')

Upvotes: 0

Related Questions