[jQuery] Re: Select Option add Class

2009-08-10 Thread Benn
this worked great! thank you muchly! On Aug 10, 11:19 am, Eduardo Pinzon wrote: > try this: > $("#custom1 option").each(function(){ >       var class = $(this).html(); >       addClass(class); > > }); > > Eduardo Pinzon > Web Developer > > 2009/8/10 Benn > > > > > This might have been resolved,

[jQuery] Re: Select Option add Class

2009-08-10 Thread Eduardo Pinzon
try this: $("#custom1 option").each(function(){ var class = $(this).html(); addClass(class); }); Eduardo Pinzon Web Developer 2009/8/10 Benn > > This might have been resolved, but I can't find a solution with my > search. I'm trying to add a class with the text of the option. Simple

[jQuery] Re: Select Option add Class

2009-08-10 Thread amuhlou
You can achieve this with a loop using the each method: $('select#custom1 option').each(function(){ var theText = $(this).html(); $(this).addClass(theText); }); However, with your current HTML, the class names will have spaces in them, which isn't valid.