简体   繁体   English

IE 11 v11不尊重单个计算机上输入的“禁用”属性

[英]IE 11 v11 does not respect “disabled” property on inputs on a single machine

I support an asp.net web application using Jquery v3.3.1 which uses JavaScript to disable various inputs of type "text" or "date" using code like the following: 我支持使用Jquery v3.3.1的asp.net Web应用程序,该应用程序使用JavaScript禁用如下所示类型的“文本”或“日期”类型的各种输入:

$('#id').prop('disabled',true);

When this bit of javascript is applied to an input of type "text" or "date" its appearance changes to greyed-out and a user cannot edit the contents of the input. 当这部分javascript应用于类型为“文本”或“日期”的输入时,其外观将变为灰色,并且用户无法编辑输入的内容。

The problem is, when this page is viewed in IE 11 on one machine in our building the "disabled" property of inputs of type "text" or "date" is partially ignored. 问题是,当在我们建筑中的台计算机上的IE 11中查看此页面时,将部分忽略“文本”或“日期”类型的输入的“已禁用”属性。 Hundreds of machines access this web page but only one machine is known to have this issue. 数百台计算机访问此网页,但是只有一台计算机出现此问题。

By "partially ignored" I mean that when the input's 'disabled' property is set true as in the code snippet above the input appears disabled, but the user is able to type values into the disabled input (any masks on the input are ignored; for example, date masks, or masks that limit inputs to integers). “部分忽略”是指当输入的“ disabled”属性设置为true时,如上面的代码段所示,该输入显示为禁用,但是用户可以在禁用的输入中键入值(输入中的任何掩码都将被忽略;例如日期掩码或将输入限制为整数的掩码)。

On the bright side, these phantom values typed into the disabled input are also ignored; 从好的方面来说,这些键入到禁用输入中的幻像值也将被忽略; for example, if the input is of type "date" and the user enters the word "cat", no client-side validation error occurs, and when the form is posted back the value for the input is null, which is of course the desired state. 例如,如果输入的类型为“ date”,并且用户输入单词“ cat”,则不会发生客户端验证错误,并且在将表单回发时,输入的值为null,这当然是所需状态。

In sum, this is strictly a cosmetic problem. 总之,这严格来说是一个表面问题。 Functionally the page behaves the same on the problem machine as it does everywhere else. 从功能上讲,页面在问题机器上的行为与其他地方相同。

I originally assumed that this problem was due to the problem machine having a version of IE that no other machine in our building had (v11.0.60). 我最初认为此问题是由于问题机器具有版本IE导致的,而我们建筑物中没有其他机器(v11.0.60)。 But after upgrading the problem machine and some other machines to IE 11.0.70 the problem still remains on just the problem machine. 但是在将问题机器和某些其他机器升级到IE 11.0.70之后,问题仍然仅存在于问题机器上。 Other machines with the same IE 11.0.70 behave properly. 具有相同IE 11.0.70的其他计算机运行正常。

I've searched through the myriad IE settings, but cannot find anything different on the problem machine. 我已经搜索了无数IE设置,但是在问题机器上找不到任何不同的内容。

Is anyone else having this problem? 还有其他人有这个问题吗? Any hints on how to even debug an issue like this is much appreciated. 非常感谢您提供有关如何调试此类问题的任何提示。

IE 11 doesn't always follow the rules. IE 11并不总是遵循规则。 If you switch it to: 如果将其切换为:

$("#id").prop("disabled","disabled");

It will work in IE. 它将在IE中工作。

If you only want to run that code for IE 11 or lower, here is a way to do that from another good post. 如果您只想为IE 11或更低版本运行该代码,这是另一篇不错的文章中介绍的方法。 How to load a script only in IE 如何仅在IE中加载脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM