I have an html page that contains several Bootstrap modals. I want to close them using jquery. But, I’m having trouble selecting them.
This is a sample of the html:
<div class="modal-footer span5">
<input class="btn btn-primary" name="commit" type="submit" value="Save Material">
</div>
And this jquery(coffee script) doesn’t work:
$(".modal-footer .btn").each.click ->
alert 'commit'
$(this).modal "hide"
Or this:
$(".modal-footer .btn").click.each ->
alert 'commit'
$(this).modal "hide"
Thanks!
That’s not a javascript code. Try this:
Anyway I don’t understand why you’re closing the modal with jquery if bootstrap does that automatically.