jQuery .click event not registering with class
<p>I'm trying to register a click event for a menu list button identified by a class, but it doesn't seem to be firing.  My code is as follows:</p>

<pre><code>&lt;body&gt;
&lt;!-- jQuery Simple Drop-Down Menu http://javascript-array.com/scripts/jquery_simple_drop_down_menu/# --&gt;
        &lt;div id="dropDownDiv" style="width: 908px; height: 24px; margin: auto auto; background: #324143;"&gt;
            &lt;ul id="jsddm"&gt;
                &lt;li&gt;&lt;a href="#"&gt;Item 1&lt;/a&gt;
                    &lt;ul&gt;
                        &lt;li&gt;&lt;a class="btn myOtherClass" href="#"&gt;Button 1&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a class="btn myOtherClass"href="#"&gt;Button 2&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Item 2&lt;/a&gt;
                    &lt;ul&gt;
                        &lt;li&gt;&lt;a class="btn myOtherClass" href="#"&gt;Button 3&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a class="btn myOtherClass" href="#"&gt;Button 4&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;
            &lt;/ul&gt;
        &lt;/div&gt;

&lt;/body&gt;
</code></pre>

<p>And in my script I have the following:</p>

<pre><code>/* Register the click event for menu buttons */
$('.btn').click(function () { 
    alert("You clicked a button"); 
  });
</code></pre>

<p>The alert never fires and I'm not sure why, any help is appreciated.</p>

<p>UPDATE:</p>

<p>The code in the link works for me to, not sure why it's not working in my project.  I'm in an Eclipse PHP Project environment with Java resources enabled.  I tried my project in Chrome and Firefox, not working for either.  I'll check the rest of my script.</p>

<p>UPDATE 2:</p>

<p>Looks like Shef's recommendation about wrapping in a .ready function did the trick.  I still don't understand why it needs that to work, "c=smiles"'s link worked without it.</p>
