我试图弄清楚如何将多个变量传递给bootstrap模式。我知道如何传递一个变量,但我无法弄清楚如何发送两个变量。我可以在下面的同一链接中添加两个变量。
我想再添加一个项目
<a data-id="<?=$sid?>" class="open-AddsigningId btn btn-primary btn-xs" href="#PaySigning">Pay Signing</a>
这是jquery脚本
$(document).on("click", ".open-AddsigningId", function (e) {
e.preventDefault();
var _self = $(this);
var mysignId = _self.data('id');
$("#signId").val(mysignId);
$(_self.attr('href')).modal('show');
});
这是我将项目传递给
的模式<!--Pay Signing-->
<div class="modal fade" id="PaySigning" 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" id="myModalLabel">Pay Signing</h4>
</div>
<div class="modal-body">
<div class="row well">
<form action="formpross.php" id="closeform" method="post" class="form-horizontal" role="form">
<div class="row">
<div class="col-xs-3">
<label for="totalowed" class="control-label">Total Owed:</label>
<input name="totalowed" type="text"id="totalowed" class="form-control input-sm"/>
</div>
</div>
<div class="row">
<div class="col-xs-4">
<label for="paiddate" class="control-label">Paid Date:</label>
<input name="paiddate" type="text"id="datepicker1" class="form-control input-sm" data-toggle="tooltip" data-placement="right" title="Date the signing company paid the invoice" value="<?php echo $paiddate;?>">
</div>
<div class="col-xs-3">
<label for="totalpaid" class="control-label">Total Paid:</label>
<input name="totalpaid" type="text"id="totalpaid" class="form-control input-sm"/>
</div>
<div class="col-xs-3">
<label for="checkn" class="control-label">Check Number:</label>
<input name="checkn" type="text"id="checkn" class="form-control input-sm"data-toggle="tooltip" data-placement="right" title="Check Number of the check from the signing company" value="<?php echo $checkn;?>">
</div>
</div>
<div class="modal-footer">
<input name="id" id="signId" type="hidden" value=""/>
<input name="pid" type="hidden" value="<?php echo $pid;?>"/>
<input name="processtp" type="hidden" value="paysigning"/>
<button id="submit" class="btn btn-primary btn-block btn-xs center">Pay Signing</button>
</div>
</form>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
答案 0 :(得分:4)
您可以使用任意数量的data-*
属性
<a data-id="<?=$sid?>" data-something="<?=$somevalue?>" class="open-AddsigningId btn btn-primary btn-xs" href="#PaySigning">Pay Signing</a>
然后
var something= _self.data('something');
$("#something").val(something);