toggleClass() only working on odd elements
<p>I'm creating a little application and I can't figure out why selecting items isn't working on it. I tried it using toggleClass(), but it had the same impact. Toggle class 'selected' only works on odd elements.</p>

<p><a href="http://codepen.io/sobrancelhas/pen/ENQvgy" rel="nofollow noreferrer">http://codepen.io/sobrancelhas/pen/ENQvgy</a></p>

<pre><code>    $(document).ready(function() {

    $('#options :checkbox').change(function() {
        if (this.checked) {
            $('#botao').addClass('adicionar');
            $('#botao').html('Add');
        } else {
            $('#botao').removeClass('adicionar');
            $('#botao').html('Remove');
        }
    });

    $('#botao').click(function() {
        if($(this).hasClass('adicionar')){
            $('#container').append('&lt;div class="item"&gt;ITEM&lt;/div&gt;');
        } else {
            $('#container').find(".item:last").remove();
        }

        $('.item').click(function(){
                if($(this).hasClass('selected')){
                    $(this).removeClass('selected');
                } else {
                    $(this).addClass('selected');
                }
        });

    });

});
</code></pre>