我遇到了bootstrap模式的问题。
我有多个按钮调用相同的模态。每个人都向模态文件发送不同的id。问题是模态没有得到不同的id。它只会一直得到第一个。
模式中的JQUERY示例:http://80.179.226.44/~israelig/sites/exmytrip/tempFile.php示例模式中没有JQUERY:http://80.179.226.44/~israelig/sites/exmytrip/tempFile2.php
如果我从模态删除JQUERY调用而不是模态获取不同的id,但其他脚本不再工作(上传图像脚本)
主文件:
<li><a href="modalFile.php?id=1" data-toggle="modal" data-target="#myModal"> Send value "1" to modal</a></li>
<li><a href="modalFile.php?id=2" data-toggle="modal" data-target="#myModal"> Send value "2" to modal</a></li>
<li><a href="modalFile.php?id=3" data-toggle="modal" data-target="#myModal"> Send value "3" to modal</a></li>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-md">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Title for modal</h4>
</div>
<div class="modal-body">
</div>
</div>
</div>
</div>
</body>
<script>
// clear model content
$('body').on('show.bs.modal', '.modal', function () {
$(this).removeData('bs.modal');
});
</script>
模态文件:
<div class="modal-body">
<form id="modal-form" action="index.php?id=1" method="post" enctype="multipart/form-data" >
<div class="form-group">
<label class="control-label">Images</label>
<input id="input-8" name="file[]" multiple type="file" class="file-loading*">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button class="btn btn-success submit">Send <i class="fa fa-arrow-left"></i></button>
<div class="form-msg"></div>
</div>
</form>
</div>
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<link href="css/fileinput.min.css" rel="stylesheet">
<link href="css/fileinput-rtl.min.css" rel="stylesheet">
<script src="js/files_upload/fileinput.min.js"></script>
<script src="js/files_upload/themes/explorer/theme.js"></script>
<link href="js/files_upload/themes/explorer/theme.css" rel="stylesheet">
<script>
$(document).on('ready', function() {
$("#input-8").fileinput({
rtl: true,
language: "he",
allowedFileExtensions: ["jpg", "png", "gif"],
maxFileCount: 10,
maxFilePreviewSize: 5120, // 5 MB
maxImageWidth: 150,
maxImageHeight: 100,
resizePreference: 'height',
resizeImage: true,
theme: "explorer",
validateInitialCount: true,
// uploadUrl: "images/users_files",
showRemove: true,
showUpload: false,
showZoom: false,
// required: true,
overwriteInitial: false,
initialPreviewAsData: true,
layoutTemplates: {
main1: "{preview}\n" +
"<div class=\'input-group {class}\'>\n" +
" <div class=\'input-group-btn\'>\n" +
" {browse}\n" +
" {upload}\n" +
" {remove}\n" +
" </div>\n" +
" {caption}\n" +
"</div>"
}
});
});
</script>