我有一个带有一些href
属性的标签。我还会制作一个带有“是”和“否”按钮的引导对话框。然后单击此标记,我将调用javascript函数。在此javascript函数中,我将其称为模式。
当用户单击“是”,然后单击href
链接,如果单击“否”,则不执行任何操作。
function reassigned(arr) {
$('#reassigned .title').text('Reassigned To Opener');
$('#reassigned').modal('show');
$('#reassigned .ignore').click(function() {
alert(false);
return false;
});
$('#reassigned .confirm').click(function() {
alert(true);
return true;
});
return false;
}
<span><a class="btn btn-blue-o" title="Reassigned To Opener" href="<?php echo base_url() ?>modules/php1.php" onclick="return reassigned('1')"><i class="fa fa-repeat"></i></span>
<div class="modal fade" id="reassigned" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title title"></h4>
</div>
<div class="modal-body">Are you sure about this action?</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-default ignore" type="button">Ignore</button>
<button class="btn btn-success confirm" type="button">Confirm</button>
</div>
</div>
</div>
</div>