view raw
Denis Stephanov Denis Stephanov - 9 months ago 32
jQuery Question

How to use bootstrap modal in conditions in JavaScript function

how can I implement bootstrap modal window to decide condition in javascript function,
For example, I had created BS modal by BS Docs with "Yes" and "No" buttons, and js function:

function myFunction () {
var modal = $("#myModal").show();

if (modal.userOption == yes) { //do something }
else { //end function }

Is possible anything like that? Thanks


Here is a good Descripiton If you want to listen do the users button Click to something like this: (Plain JQuery)


<script src=""></script>
<div class="modal fade" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">Modal title</h4>
      <div class="modal-body">
        <p>One fine body&hellip;</p>
      <div class="modal-footer">
        <button type="button" id="closeButton" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" id="saveButton"class="btn btn-primary">Save changes</button>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->