Confirmation with Bootstrap modal [duplicate]

0

I have a system that I'm using Bootstrap. I would like to know if you have as in the actions of registering, instead of appearing the famous phrase "Your registration was successful!" of the JavaScript alert, appear in Bootstrap Modal.

    
asked by anonymous 16.10.2015 / 13:59

2 answers

2

You can use it to open via js:

$('#myModal').modal('show');

$(function() {
  $('#openModal').click(function() {
     $('#myModal').modal('show');
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><!--LatestcompiledandminifiedCSS--><linkrel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script><divclass="container">
  <h2>Modal Example</h2>
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" id="openModal">Open Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <p>Some text in the modal.</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>

    </div>
  </div>

</div>
    
16.10.2015 / 14:20
0

I managed to fix the solution right here on the Stack. Anyone who wants a similar solution, see this <div id="myModa3" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

Jquery:

 $(document).ready(function() {
        $('#myModa3').modal();
    });

The solution was by colleague Caio Silva.

Thank you all!

    
16.10.2015 / 14:38