javascript Remove value from array, array problems
<p>I am trying to fill an array with strings, the elements that will be added are the HTML of the clicked &lt;\li>, im probably filling it correctly.</p>

<p>My problem is when the user clicks on the checked link again, i want to remove this item from the array</p>

<p>Here is a code sample:</p>

<pre><code>$(document).ready(function(){
    var chosen = [];
    var chosenCounter = 0;

            find("ul").find("li").click(function(){
        var checkBox = $(this).find("img").first();
        var checkBoxSrc = checkBox.attr("src");
        if(checkBoxSrc == "images/unchecked.png"){
            checkBoxSrc = "images/checked.png";
            checkBox.attr("src",checkBoxSrc);
            checkBox = "";
            checkBoxSrc = "";
            var temp = this.outerHTML;
            chosen[chosenCounter] = temp;
            chosenCounter ++;
        }
        if(checkBoxSrc == "images/checked.png"){
            checkBoxSrc = "images/unchecked.png";
            checkBox.attr("src",checkBoxSrc);
            checkBox = "";
            checkBoxSrc = "";



    for (var j =0; j&lt;=chosen.length; j++){
            var tempRemove = this.outerHTML;
            chosen.splice( chosen.indexOf( tempRemove ), 1 );
            tempRemove = '';
        }
    }
});
</code></pre>

<p>});</p>

<p>I have been trying all functions and ways i found on internet .. but the results doesn't works well, i would be very thankful for a correction and explanation.
Thanks all in advance.</p>
