JavaScript: value of an object on a click event
<p>I'm working on a codecademy.com lesson that's teaching me how to build a bar graph with jQuery. The last set of instructions are to add a click event to $bar to display it's value. It explains</p>

<blockquote>
  <p>Anonymous functions go like this: <code>function(arg) { code }</code>. In this
  case, a .click handler will have e, the click event, as its argument,
  so your implementation should have <code>function(e) { alert code }</code> within
  the <code>.click()</code>.</p>
</blockquote>

<p>Here's the function I'm supposed to modify</p>

<pre><code>// Exercise 5
function addBarClickEvent($bar,value) {
    // add a click event to the bar that 
    // pops up an alert with the bars value
    $bar.click(
        // your code goes here!

        }
    );
}
</code></pre>

<p>I tried both of the solutions shown below but neither worked. The lesson doesn't provide a solution unfortunately. Can anyone help. </p>

<pre><code>// Exercise 5
    function addBarClickEvent($bar,value) {
        // add a click event to the bar that 
        // pops up an alert with the bars value
        $bar.click(
            // your code goes here!
              alert($bar.value)       //my attempt
              alert(e.value)          //my second attempt
            }
        );
    }
</code></pre>

<p>I'm getting this error message</p>

<blockquote>
  <p>Make sure to define the argument to .click as an anonymous function
  that displays the alert.</p>
</blockquote>
