show modal jquery code example
Example 1: onclick open modal jquery
$('#myModal').modal('toggle');
$('#myModal').modal('show');
$('#myModal').modal('hide');
Example 2: onclick open modal jquery
$('#myModal').modal('show');
Example 3: jquery on modal show
$(window).on('shown.bs.modal', function() {
$('#code').modal('show');
alert('shown');
});
Example 4: modal show jquery event
<div class="modal fade" id="phoneEdit" tabindex="-1" role="dialog" aria-labelledby="phoneEdit" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header center">
<label class="large-text bold text-align-left">
<?= __d('member', 'edit_password'); ?>
</label>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
</div>
</div>
</div>
</div>
$("#phoneEdit").on('shown.bs.modal', function(e){
console.log('enter here');
// do anything after the modal open
$(".number_six").val("");
});
Example 5: jquery modal popup
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" />
Embed modal HTML in document
Create a link with rel="modal:open" and set the href attribute to the modal's DOM id.
<div id="ex1" class="modal">
<p>Thanks for clicking. That felt good.</p>
<a href="#" rel="modal:close">Close</a>
</div>
<p><a href="#ex1" rel="modal:open">Open Modal</a></p>
Example 6: jquery dialog modal on modal
.ui-dialog { z-index: 1100 !important ;}