Data-Dismiss: How to dismiss bootstrap modal inside function

javascript, jquery, twitter-bootstrap

Solution

What have you tried so far?

Per the Bootstrap documentation

$('#myModal').modal('hide')

Please read through the documentation! http://getbootstrap.com/javascript/#modals

Problem

I have a modal in which I need to validate some input using knockout validation. When I click the submit button, a function is called that validates the data. The following functionality is expected: - If the validation fails, the modal stays open and the validation reason is displayed. - If the validation succeeds, I want to close the modal. How can I go about closing the modal inside my function?

Original source