0

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

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.

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.

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

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.

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.

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.

Tom Regan
  • 3,580
  • 4
  • 42
  • 71
  • @pendo Would you like to turn that into an answer? Rephrasing for politeness and adding some explanation would make it quite a decent one. – Yunnosch Aug 10 '18 at 16:43

1 Answers1

1

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

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

It will work in 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

pendo
  • 792
  • 2
  • 5
  • 27
  • This fixes the issue on our problem machine, so I'm marking it as the answer, but of course I've changed the question, what I'd really like to know is "why is this happening on only one machine?" – Tom Regan Aug 10 '18 at 21:17
  • "Doesn't always" sounds weird. Difference in compatiblity mode? – Kukeltje Sep 13 '18 at 10:04
  • Setting the value of the disabled attribute to 'disabled' works for IE, including compatibility mode back through IE9 https://msdn.microsoft.com/en-us/library/hh781508(v=vs.85).aspx Before IE9 and I don't have those VMs installed anymore to test against, so I have no idea. – pendo Sep 13 '18 at 14:56