1
我是1的值传递给模态的输入框,但它不会显示它引导模态,动态内容负荷
<span class="glyphicon glyphicon-user" class="Add-Dialog" data-id="1" type="button" data-toggle="modal" data-target="#myModal"> </span>
模态`
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
<input type="text" name="help" id="help" value=""/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
JS
<script>
$(document).on("click", ".Add-Dialog", function() {
var myHelpId = $(this).data('id');
$(".modal-body #help").val(myHelpId);
});
[这](HTTP:// stackove rflow.com/a/32556451/3465753)可能会对您有所帮助。 Upvote如果帮助。 –
继承人小提琴:http://jsfiddle.net/3kgbG/1013/ – DTH