How to trigger a function on a value that can change?
<p>I have some functions that are triggered when an element is clicked. The elements are stored in an array. But the value that trigger the functions change. Here is the code for the function:</p>

<pre><code>// first I store the element of a list in an array
var promo = new Array(),
indexOfTheElement = 3;
$('#list li').each(function(){
    promo.push($(this));
});

$(myArray[indexOfTheElement]).click(function(){
    indexOfTheElement--;
    // Do something
    return false;
});
</code></pre>

<p><strong>Edit:</strong> The element of a list are stored in an array, and the function is triggered when you click an element of the list. For example if you click the third element, the function will be triggered, and then it must work when you click the second.</p>
