Forums

Give help. Get help.

  • # October 13, 2013 at 2:10 pm

    Hi to everyone. My situation: I have array with 200 elements var block = document.getElementsByClassName( 'block' ); 4 of elements have additional class box. How can I set to different variables index of elements with class box. Something like:

    var first = 6 ( index of element with class box);
    var second = 67 ( index of element with class box);
    var third = 112 ( index of element with class box);
    var fourth = 189 ( index of element with class box); 
    

    Thanks for any help.

    # October 14, 2013 at 11:21 am

    Thanks @jamygolden. Your solution is very helpful, but my intention was recieve indexes, like boxes.push(i). Because of my english I couldn’t properly explain problem. Thanks again.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag