Javascript 模态can';t访问其显示功能
我有这个功能 和模态Javascript 模态can';t访问其显示功能,javascript,c#,jquery,html,twitter-bootstrap,Javascript,C#,Jquery,Html,Twitter Bootstrap,我有这个功能 和模态 $('#modalSetDonationsProducts').on('show.bs.modal', function (e) { alert("dljasld"); rowNumber = 1; $('#tblEmployees tbody tr').remove("tr:gt(0)"); alert("enterd"); var itemname = $(this).parent().parent().find(rowData[
$('#modalSetDonationsProducts').on('show.bs.modal', function (e) {
alert("dljasld");
rowNumber = 1;
$('#tblEmployees tbody tr').remove("tr:gt(0)");
alert("enterd");
var itemname = $(this).parent().parent().find(rowData["ItemName"]).val()
alert(itemname);
$(e.currentTarget).find('input[name="item"]').val(itemName);
$(e.currentTarget).find('input[name="description"]').val(itemName);
$(e.currentTarget).find('input[name="item"]').enabled = false;
});
&时代;接近
#
1.
我这样叫莫代尔
<div class="modal modal-flex " id="modalSetDonationsProducts">
<div class="modal-dialog" style="min-width: 900px; max-width:1000px;width:auto">
<div class="modal-content">
<div class="modal-header" style="width:100%;">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span> <span class="sr-only">Close</span></button>
<h4 class="modal-title"> <%= GetLocalResourceObject("addnewitem")%></h4>
</div>
<div class="modal-body">
<p><%= GetLocalResourceObject("addnewitem")%></p>
<div class="table-responsive">
<table class="table" id="tblEmployees">
<thead>
<tr>
<th>#</th>
<th></th>
</tr>
</thead>
<tbody>
<tr id="rowID1">
<td>1</td>
<td>
<input type="text" style="min-width:230px" readonly="readonly" name="item" value="" /></td> </tr>
</tbody>
</table>
</div> </div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"></button>
<button type="button" onclick="SaveProducts();" class="btn btn-green ladda-button">
</button>
</div>
</div>
</div>
</div>
已经做的是:
1.模型正确打开。
2.它无法访问('show.bs.modal',函数(e)上的$('modalSetDonationsProducts')。并至少显示第一个警报。
3.我的模式调用按钮来自另一个表,我只想通过parent.find-way设置输入name=“item”。
工作小提琴:
我猜你的目标元素出了问题,我试过你的HTML和JS事件
1. model open Correctly .
2. it can't access the $('#modalSetDonationsProducts').on('show.bs.modal', function (e) and show the first alert at least .
3. my modal call by button from another table and I just want to set the input name="item" by parent.find way.
您似乎错过了,
;
分号(警报(“dljasld”)
),因此它正在进一步执行onShowOfModal事件。我认为它没有任何效果,或者您是说,如果您的html是这样的,您不应该转义title和href。-不escaping@PoulBak没有任何变化:(,模态已打开,但警报未触发
我使用此标记调用模态,是否有任何通知?@ameenulla0007我在Jquery中动态调用此标记,因此无法删除此slashesOh..您应该在问题中清楚地提到这一点。事实上,数据切换属性在准备好HTML时是有目标的。@saradly,将通过您的函数,您在其中调用了模态调用按钮?此外,请尝试使用$('#modalSetDonationsProducts')。在('show.bs.modal',函数(e){
上,不使用任何其他语句,只需在那里尝试一个警报,然后让我知道影响是什么?
1. model open Correctly .
2. it can't access the $('#modalSetDonationsProducts').on('show.bs.modal', function (e) and show the first alert at least .
3. my modal call by button from another table and I just want to set the input name="item" by parent.find way.
$('#modalSetDonationsProducts').on('show.bs.modal', function (e) {
alert("displaying");
});