从MVC编辑器模板中搜索元素时,JQuery.Find()在IE11和Chrome中不起作用
我有一个MVC视图(部分如下所示): 我可以使用$('input[id=“save”]”)来显示输入。show()。但是,上面的JQuery是全局使用的,因此我传入了包含我想要显示/隐藏的“save”输入的表单 这一直有效,直到客户开始升级到IE10及以上。我记得它也在Chrome的早期版本中工作。在本节中:从MVC编辑器模板中搜索元素时,JQuery.Find()在IE11和Chrome中不起作用,jquery,asp.net-mvc,Jquery,Asp.net Mvc,我有一个MVC视图(部分如下所示): 我可以使用$('input[id=“save”]”)来显示输入。show()。但是,上面的JQuery是全局使用的,因此我传入了包含我想要显示/隐藏的“save”输入的表单 这一直有效,直到客户开始升级到IE10及以上。我记得它也在Chrome的早期版本中工作。在本节中: </td> @using(Html.BeginForm("UpdateProductCode", "Details", FormMethod.Post)) { <
</td>
@using(Html.BeginForm("UpdateProductCode", "Details", FormMethod.Post))
{
<td style="width: 50%">
@使用(Html.BeginForm(“UpdateProductCode”,“Details”,FormMethod.Post))
{
您的表单代码显示在TD标记之间。jQuery的哪个版本?
.live()
在1.7中被折旧,在1.9中被删除。我使用的是1.7.1版,只是为了确保我更新为使用.on()代替.live()。仍然看到相同的问题。你是对的。我将表单放在一个新单元格中,然后在该单元格中的一个新表周围添加表单,它现在可以工作了。
@model Product.Web.Models.ProductCode
<tr>
<td style="width: 5%" class="center">
@using(Html.BeginForm("RemoveProductCode", "Details", FormMethod.Post))
{
<input type="hidden" value="@Model.ProductCodeId" name="ProductCodeId"/>
<input class="center" id="remove" type="image" value="Remove" src="@Url.Content("~/Content/images/Cancel.png")" width="24px" height="24px" alt="Remove" />
}
</td>
@using(Html.BeginForm("UpdateProductCode", "Details", FormMethod.Post))
{
<td style="width: 50%">
<input type="text" value="@Model.ProductCodename" name="ProductCodename"/>
</td>
<td style="width: 45%">
<input type="text" value="@Model.BoxMaterial" name="BoxedMaterial"/>
</td>
<td style="width: 5%" class="center">
<input type="hidden" value="@ViewBag.SOWId" name="SOWId"/>
<input type="hidden" value="@Model.ProductCodeId" name="ProductCodeId"/>
<input class="right" id="save" type="image" value="Update" src="@Url.Content("~/Content/images/Ball Green Check.png")" width="24px" height="24px" alt="Update" />
</td>
}
</tr>
/toggles chages on input change
$('input, textarea, select').live('change', function (element) { ToggleChange(true, element); });});
function ToggleChange(changed, element) {
var form = element.currentTarget.form;
if (changed) {
$('#changed').html('*');
//Enable save
$(form).find('input[id="save"]').removeAttr('disabled');
$(form).find('input[id="save"]').show();
$(form).find('img[id="warning"]').hide();
}
else {
$('#changed').html('');
//disable save
$(form).find('input[id="save"]').hide();
$(form).find('input[id="save"]').attr('disabled', 'disabled');
};
}
</td>
@using(Html.BeginForm("UpdateProductCode", "Details", FormMethod.Post))
{
<td style="width: 50%">