Tank you Arian, I think I have it .

On Feb 4, 4:06 pm, Arian Stolwijk <[email protected]> wrote:
> $$('.some-selector').get('id') returns an array. You're lucky because 'string'
> + (['some array']) uses Array.toString(), which is basically
> Array.join()(which is equal to
> Array.join(',')).
>
> Next you're using $(+'somestring'+), using only +'somestring' results in NaN,
> but you're using +'somestring'+ which is a syntax error.
>
> Finally you're using .setClass, and this element method (probably) doesn't
> exist. You want to use .addClass('active').
>
> Probably you just want something like this:
>
> // save the element collection in a variable, only search for them once.
> var elements = $$('.panel');
>
> if (elements.length){
>     // use [0] to get the first element.
>     var element = document.id('nav' + elements[0].get('id'));
>     if (element) element.addClass('active');
>
> }
> On Sat, Feb 4, 2012 at 3:51 PM, hamburger <[email protected]> wrote:
> > Hello again,
> > one more problem.
> > How I have to write the sp variable in the right way to get the $
> > (div) ?
>
> > var panel = $$('.panel');
>
> > var sp = "nav-"+ panel.get('id');  // gives nav-hello
>
> > $(+'sp'+).setClass('active');      //wrong!!!!!!!!!  shoud be $('nav-
> > hello').setClass('active');

Reply via email to