1

Here is what I am trying to do:

 for (var i = 0; i < paramLength; i++) {
    if (parameters[i].substr(0, 2) == '@_')//Required
    {
        $('#ddParam' + id).append($("<option style='font-style:italic'></option>").attr("value", parameters[i]).text(parameters[i] + ' (REQUIRED)'));
    }
    else
    {
        $('#ddParam' + id).append($("<option></option>").attr("value", parameters[i]).text(parameters[i]));
    }
}

NOTICE the STYLE tag in the OPTION -- this works fine for me in FF but (hang on to your hat) -- is not working in IE8 and that (unfortunately) is the browser that I am designing this app for....

Any suggestions and thanks!

Todd Vance
  • 4,627
  • 7
  • 46
  • 66
  • 1
    Have you tried just adding it in with `.attr()` same as you are using for `value`? – Orbling May 10 '11 at 17:17
  • Thanks for the suggestion... I tried it ... ('.append($("").attr("value", parameters[i]).attr("style", "font-size:30px")....) ... .and it STILL WORKS in FF....but STILL DOESNT work in IE8. – Todd Vance May 10 '11 at 17:38
  • 1
    Have you considered that styling capabilities of ` – Orbling May 10 '11 at 18:20
  • Yes - I think this is the issue... if you will suggest this as the answer, I will mark it as such. I just dont think I am able to style the – Todd Vance May 12 '11 at 15:54
  • @toddy: As requested, an answer provided, with some further reading. – Orbling May 12 '11 at 16:41

2 Answers2

0

I suggest using classes - they are faster than adding single styles one by one. Use on jQuery object addClass('classnameX') or if you like styles: css({'key1':'val1','key2':'val2'}).

pmaruszczyk
  • 2,157
  • 2
  • 24
  • 49
0

Have you considered that styling capabilities of <select> elements is very browser specific.

IE did not support that prior to IE8, browsers vary in style on that element a good deal as they do with many form elements.

Further Questions:

Community
  • 1
  • 1
Orbling
  • 20,413
  • 3
  • 53
  • 64