Reputation: 6996
I'm replicating a scenario from my application,
HTML:
<input type='text' disabled='true' />
<input type='text' disabled='true' />
<input type='text' disabled='true' />
<input type='text' disabled='true' />
<div disabled='true'>
<input type='text' disabled='true' />
</div>
<input type='text' disabled='true' />
<p id='test'></p>
I want to enable these elements on a button click, the equivalent js,
var x = document.querySelectorAll('input[type="text"]');
var p = document.querySelector('#test');
[].slice.call(x);
for (var i = 0; i < x.length; i++) {
p.innerHTML += x[i].getAttribute("disabled") + " ";
x[i].removeAttribute("disabled");
}
Works fine in all browsers,
but, in IE, the input
with it's parent disabled, appears disabled, but isn't.
Any explanation as to why this is happening?
I do realize that disabled
is not a valid property for a div
, but IE should ignore such a property?
Upvotes: 3
Views: 231
Reputation: 4165
This doesn't conclude it is a bug but gives a little more insight into things.
http://www.techtamasha.com/the-disabled-attribute-in-internet-explorer/256
Directly from that article:
‘disabled’ attribute only works on BUTTON INPUT, OPTGROUP, OPTION, SELECT, and TEXTAREA tags and the general policy of browser is if you use any attribute which are not authorized to use in tag then browsers neglect them but they can be accessed using javascript. But IE isn’t that kind in this case. If you apply ‘disabled’ on div tag, IE takes it seriously and makes div tag disabled. So what this means is that we not only have any control event on div but also according to “This attribute is inherited but local declarations override the inherited value.” rule in W3C disable specification, IE applies disabled attribute on nested elements in div tag. So be careful.
Upvotes: 4