IE 11 v11不遵守“禁用"的要求.单台机器上输入的属性 [英] IE 11 v11 does not respect "disabled" property on inputs on a single machine

查看:79
本文介绍了IE 11 v11不遵守“禁用"的要求.单台机器上输入的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我支持使用Jquery v3.3.1的asp.net Web应用程序,该应用程序使用JavaScript禁用类似以下代码的文本"或日期"类型的各种输入:

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:

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

当这部分javascript应用于类型为文本"或日期"的输入时,其外观将变为灰色,并且用户无法编辑输入的内容.

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.

问题是,当在我们建筑物中的机器上的IE 11中查看此页面时,将部分忽略文本"或日期"类型的输入的禁用"属性.数百台计算机访问此网页,但已知只有一台计算机出现此问题.

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. Hundreds of machines access this web page but only one machine is known to have this issue.

部分忽略"是指当输入的"disabled"属性设置为true时,输入上方的代码段显示为禁用,但是用户可以在禁用的输入中键入值(输入中的任何掩码)会被忽略;例如,日期掩码或将输入限制为整数的掩码).

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).

从好的方面来说,这些键入到禁用输入中的幻像值也将被忽略;例如,如果输入的类型为"date",并且用户输入单词"cat",则不会发生客户端验证错误,并且在将表单回发时,输入的值为null,这当然是所需状态.

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.

总而言之,这严格来说是一个表面问题.在功能上,该页面在问题机器上的行为与在其他所有机器上相同.

In sum, this is strictly a cosmetic problem. Functionally the page behaves the same on the problem machine as it does everywhere else.

最初,我认为此问题是由于问题机器具有版本IE导致的,而我们建筑物中没有其他机器(v11.0.60).但是,在将问题机器和某些其他机器升级到IE 11.0.70之后,问题仍然仅存在于问题机器上.具有相同IE 11.0.70的其他计算机正常运行.

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). But after upgrading the problem machine and some other machines to IE 11.0.70 the problem still remains on just the problem machine. Other machines with the same IE 11.0.70 behave properly.

我已经搜索了无数IE设置,但是在问题机器上找不到任何不同的内容.

I've searched through the myriad IE settings, but cannot find anything different on the problem machine.

还有其他人遇到这个问题吗?非常感谢您提供有关如何调试此类问题的任何提示.

Is anyone else having this problem? Any hints on how to even debug an issue like this is much appreciated.

推荐答案

IE 11并不总是遵循规则.如果您将其切换为:

IE 11 doesn't always follow the rules. If you switch it to:

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

它将在IE中工作.

如果您只想为IE 11或更低版本运行该代码,这是另一篇不错的文章中介绍的方法. 如何仅在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. How to load a script only in IE

这篇关于IE 11 v11不遵守“禁用"的要求.单台机器上输入的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆