kknaufal
kknaufal

Reputation: 25

input[type="text"]:disabled not working for IE

I want to change control's background color, when it is on disabled. For that I am using:

In css file

 input[type="text"]:disabled{background:red;} 

in Html file

<input tyepe="text" disabled="" >

it is working properly on Chrome and Mozilla, but not working in Internet Explorer.

How can I fix that.

Thanks.

Upvotes: 2

Views: 5829

Answers (2)

CodingIntrigue
CodingIntrigue

Reputation: 78525

Only IE9+ supports the :disabled pseudo-selector as per the MSDN docs. IE7+ supports CSS attributes selectors though:

input[type="text"][disabled] {
  background: red;
}

Upvotes: 9

John
John

Reputation: 6268

This works for me in IE9

input[type="text"][disabled="disabled"]{background:red;}

Upvotes: 3

Related Questions