jQuery -> problem with combination of selectors - div -> class -> a
<p>I have a problem with selectors in jQuery.</p>

<p>I have the following structure: <a href="http://img46.imageshack.us/img46/3639/structureb.png" rel="nofollow">http://img46.imageshack.us/img46/3639/structureb.png</a></p>

<pre><code>&lt;div id="myDatepicker" class="hasDatepicker" style="display: inline-block;"&gt;
    &lt;div class="ui-datepicker-inline ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"&gt;
        &lt;table class="ui-datepicker-calendar"&gt;
            &lt;tbody&gt;
                &lt;tr&gt;
                    &lt;td class="ui-body-c" onclick="DP_jQuery_1297589131703.datepicker._selectDay('#myDatepicker',1,2011, this);return false;"&gt;
                        &lt;a class="ui-state-default ui-btn ui-btn-up-c" href="#" data-theme="c"&gt;1&lt;/a&gt;
                    &lt;/td&gt;
                    ...
</code></pre>

<p>In jQuery I do this:</p>

<pre><code>$(".ui-datepicker-calendar a").live("click", function() {
    $("#myDatepicker").hide();
});
</code></pre>

<p>This works like I expect it, my datepicker will be hidden if I click on a day of the month.
But the problem is, I have two datepickers on one page. So with this jQuery code, both datepickers will "call" this function, because both matches <code>.ui-datepicker-calendar a</code>. So I need a "better" selector.</p>

<p>My datepickers have the names <code>myDatepicker1</code> and <code>myDatepicker2</code> (instead of the HTML code above <code>myDatepicker</code>) and I tried this:</p>

<pre><code>$("#myDatepicker1 .ui-datepicker-calendar a").live("click", function() {
    alert("datepicker1");
});
</code></pre>

<p>But this does not work, I get no alert message. So how can I check if a user clicks a link <code>a</code> which is under the class <code>.ui-datepicker-calendar</code> (this works), and is under the id <code>#myDatepicker</code> (this does not work with my jQuery code)?</p>

<p>Does anyone know?</p>

<p>Thank you in advance &amp; Best Regards, Tim.</p>
