PiaklA
PiaklA

Reputation: 505

jQuery .css() function not Working in IE

I was using the Add class method

 $("select[name='" + ABC+ i + "']").addClass('addBorder');

This was working in Chrome , FF , safari but not on IE So changed it to the .css property ;

 $("select[name='" + ABC + i + "']").css({"border-color":"red"});

But this is not working either in IE ; Does any one have more suggestions on it ?

Upvotes: 0

Views: 2298

Answers (3)

Fabrizio Calderan
Fabrizio Calderan

Reputation: 123377

On older IE you cannot change the border of a select element (and, unfortunately, a lot of other things). That's why it seems it doesn't work

As countercheck, $("select[name='" + ABC+ i + "']").length should be greater than zero on every browser you're trying (IE included)

If you have to change border I just suggest to wrap your select into another element and set a border-color to that wrapper.

Upvotes: 3

T. Junghans
T. Junghans

Reputation: 11683

The select element is the last html element you'll ever want to style with css. I once spent hours trying to customize the select element and got nothing but frustration! Don't do anything to it because very browser has it's own little issues with it. Your client has to live with this fact.

Upvotes: 0

Nicola Peluchetti
Nicola Peluchetti

Reputation: 76880

I think that the problem is that you can't apply border to a <select> in he, look at this question IE6/IE7 css border on select element

Upvotes: 1

Related Questions