Jeroen,

In your code "lang" is going to be undefined.  Try something like this:

$('li').each(function() {
   var $this = $(this);
   $this.addClass($this.attr('lang'));
});

Mike

On 7/25/07, Jeroen Coumans <[EMAIL PROTECTED]> wrote:

Hi,

I'm trying to put an attribute value as a class in my element:

HTML:
<ul>
<li lang="en">text</li>
<li lang="nl">text</li>
<li lang="it">text</li>
</ul>

jQuery:

$("li").each(function(){
        var lang = $('#language [EMAIL PROTECTED]');
        $(this).addClass(lang);
});

Which gives an error about c.split not being a function. Quoting lang
sets all classes to lang. Anybody got a cluebat for me?

Thanks!


Reply via email to