0

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 ?

3
  • Is there any error you get in IE? When the code runs? Commented Mar 19, 2012 at 13:50
  • Try switching your quotes around: $('select[name="' + ABC + i + '"]') Commented Mar 19, 2012 at 13:51
  • Switching quotes didn't work for me This is the problem for all IE versions I am getting the error on IE as object not supported Commented Mar 19, 2012 at 14:55

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

.length is returning the Value as 1 , so elements is being fetched , let me try wrapping it around and see what do i get
1

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

1 Comment

Yes that's what I was afraid of. Thanks for the link
0

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.

1 Comment

Yes you are right. Thanks for the link , I had to use another jQuery tag to check the browser and display the alert window rather than showing the element with red background.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.