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