Jquery function to javascript function
<p>I have functlion which is working perfactly. Now the client’s requirement is that he doesn’t want to use any other file for js, so I have change this function to be pure JavaScript, i.e. without jQuery. I am confused where to start.</p>

<p>Can you guys tell me a JavaScript function similar to jQuery’s <code>.size</code> method?</p>

<p><a href="http://jsfiddle.net/CgDS6/8/" rel="nofollow">http://jsfiddle.net/CgDS6/8/</a></p>

<pre><code>    &lt;div class="wrap"&gt;
        &lt;ul&gt;
            &lt;li&gt;
                &lt;div class="first"&gt;
                    &lt;div class="second"&gt;&lt;/div&gt;
                &lt;/div&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;div class="first"&gt;
                    &lt;div class="active"&gt;&lt;/div&gt;
                &lt;/div&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;div class="first"&gt;
                    &lt;div class="second"&gt;&lt;/div&gt;
                &lt;/div&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
        &lt;a href="#" id="next"&gt;Next&lt;/a&gt;
    &lt;/div&gt;

var $firstSecond = $('.second').eq(0);
$('#next').click(function() {
    var $active = $('.active');
    var $nextSecond = $active.closest('li').next().find('.second');
    $active.toggleClass('active second');
    if ($nextSecond.size() != 0) {
        $nextSecond.toggleClass('second active');
    } else {
        $firstSecond.toggleClass('second active');
    }
});
</code></pre>
