使用jquery将多个items变量传递到Bootstrap模态中
passing more than one items variable into a Bootstrap modal with jquery
我正试图弄清楚如何将多个变量传递到引导模式中。我知道如何传递一个变量,但我不知道如何发送两个变量。我可以在下面的同一个链接中添加两个变量吗。
我想再添加一个类似的项目
<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 -->
您可以使用任意数量的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);
相关文章:
- 获取表单值并在提交时将其传递给Bootstrap模态
- Bootstrap模态主体:Json在上传Codeigniter后刷新
- Bootstrap 模态填充了相同的单个值 - Meteor+React
- Twitter Bootstrap 模态背景不会覆盖 iPad 上的整个屏幕
- ASP.NET Bootstrap 模态作为 JavaScript 确认
- AngularJS UI Bootstrap 模态无法从作用域执行函数
- React-Bootstrap 模态表单条目
- Bootstrap模态会在第二个打开模态时自动添加一个边距
- 将变量传递到Bootstrap模态中
- Bootstrap模态形式获胜't提交淘汰赛's提交绑定
- react bootstrap模态-我如何让它显示出来
- 使用jquery将多个items变量传递到Bootstrap模态中
- 隐藏Angular Bootstrap模态而不是关闭
- 如何从AngularJS正确打开和关闭Bootstrap模态
- 将图像和时尚文本传递到Bootstrap模态
- Bootstrap模态-打开元素的奇怪位置
- 修改默认值“;驳回“;Bootstrap模态的行为
- 将JSON数据加载到Bootstrap模态中
- 我如何通过javascript调用时传递数据到Bootstrap模态
- 模态体不会出现在bootstrap模态中