我将值1传递给模态输入框,但它不显示
SELECT SUM(quantity)
FROM downloads
WHERE
date>=CURRENT_DATE()
AND date<CURRENT_DATE() + INTERVAL '1' DAY
模态`
<span class="glyphicon glyphicon-user" class="Add-Dialog" data-id="1" type="button" data-toggle="modal" data-target="#myModal"> </span>
JS
<!-- 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>
答案 0 :(得分:1)
<div class="modal-content" id="myModal"> <!--Add modal id-->
<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>
<强>
Then in js
强>
$('#myModal').on('show.bs.modal', function (event) {
var span = $(event.relatedTarget) // Span that triggered the modal
var myHelpId = span.data('id') // Extract info from data-* attributes
$(this).find("#help").val( myHelpId );
})
有关详细信息,请参阅此示例http://getbootstrap.com/javascript/#modals-related-target