Why does Disabled = ture for html work?

I noticed in our code that there is disabled = ture' I'm the source code for the anchor tag. I was wondering why this works in IE. I also searched the Internet, and it is also used in many source codes through web searches. I searched if this is true, and IE may mistakenly use the incorrect spelling of truth.

Does anyone have any ideas about this?

+4
source share
6 answers

Previously, to disable an element, you simply made <input type="text" disabled> , so most browsers don't care what happens in this attribute. I believe that making it disabled="disabled" become the standard solely to ensure that the code is valid XML.

+12
source

IE only checks for the disabled property. This value does not matter.

+5
source

If you use a dojo framework to render a GUI widget, the value of this HMTL markup may affect the rendering of your components (and is different for older IE browsers). Dojo draws attention to the value of the DOM object representing the disabled attribute. For example, this markup will display an enabled widget enabling Chrome or> = IE9:

 disabled="false" 

This is the opposite of how vanilla HTML components behave, which will be disabled solely because the attribute is disabled (as is the case with the Zed post).

In Chrome and IE9 / later, the value of the disabled attribute is accurately stored in the DOM object that represents it (for example, if the attribute is not in the markup, this attribute is not even defined on the DOM object). Since the DOM object is that Dojo drives when it displays its widgets, the value in the HTML markup will have an effect.

In IE8 / earlier, the attribute value is stored in the DOM differently. Firstly, the disabled attribute is always present, and secondly, only its absence ensures that the value is false (in this case, the Dojo widget will be displayed turned on).

Note. Modern IE browsers can be used to change their behavior in older versions (for example, the X-UA-Compatible meta tag using content="IE=8" ).

Example 1 valid html markup

As with Zed, only one of them should be enabled (in any browser):

 <button>OK</button> <button disabled>OK</button> <button disabled="false">OK</button> <button disabled="true">OK</button> <button disabled="mickey">OK</button> <button disabled="">OK</button> 

Example 2 Dojo html markup

The first and third of them are activated using Dojo (in Chrome / IE9 or later):

 <button dojoType="dijit.form.Button">OK</button> <button dojoType="dijit.form.Button" disabled>OK</button> <button dojoType="dijit.form.Button" disabled="false">OK</button> <button dojoType="dijit.form.Button" disabled="true">OK</button> <button dojoType="dijit.form.Button" disabled="mickey">OK</button> <button dojoType="dijit.form.Button" disabled="">OK</button> 

In IE8 or lower, it will display exactly the same as in the first example.

Strange "" evaluates to false in JavaScript, but does not translate it into a false value in the context of the above examples (and therefore the widget included).

+1
source

The disable attribute can take one value: 'disabled'

All instances of this attribute in HTML allow you to exclude quotation marks, separator, and name (leaving only an unquoted value).

Since browsers implement soup tag parsers and perform a huge number of bug fixes, disabled = almost everything will be considered disabled .

(And I believe that for some reason, Microsoft has implemented disabled on anchors, despite the attribute not existing for this element).

0
source

IE is notorious for letting HTML work with errors; therefore, many people mistakenly β€œblame” him for problems, but in reality they are simply mistaken.

I believe that IE allows you to set dialogs to any (other than false) value, which means that this is true, because I think in the past people wrote disabled='disabled' and other similar things.

-one
source

you can use this code if you want to disable it according to user level insert it inside the input form tag to help

 <?php if($_SESSION['user_level']=="level1") { ?> disabled="disabled" <?php } ?> 
-one
source

All Articles