我使用jQuery的datepicker ui。日历加载正常。现在,我想在选择一天时触发显示当前日期的事件。我正在尝试使用this但没有任何运气。使用jquery datepicker显示当前日期onclick
功能如下:
$(document).ready(AllPageLoads);
function AllPageLoads()
{
$('#datepicker').datepicker();
$('table.games tbody tr.top').each(function (index) { if (index % 2 == 0) { $(this).addClass("even"); } else { $(this).addClass("odd"); } });
$('table.games tbody tr.bottom').each(function (index) { if (index % 2 == 0) { $(this).addClass("even"); } else { $(this).addClass("odd"); } });
}
function EpicFail(response, status, error)
{
alert(response + "/" + status + "/" + error);
}
$('.selector').datepicker("option", "onSelect", function (dateText, inst) {
alert(dateText);
});
HTML:
<h2>Current Data</h2>
<div id="datepicker">
</div>
<p>All Times Pacific/p>
<table id="games" class="games">
<thead>
<tr>
<th>Date</th>
<th>Data</th>
<th>Col1</th>
<th>Col2</th>
<th>Data1</th>
<th>Data2</th>
<th>Data3</th>
</tr>
</thead>
<tbody>
<tr class="left">
<td>6/9/2011</td>
<td>901</td>
<td>Team1</td>
<td>Payer1</td>
<td>info1</td>
<td>OFF</td>
<td>OFF</td>
</tr>
<tr class="right">
<td>4:05 PM</td>
<td>902</td>
<td>Team2</td>
<td>Palyer2</td>
<td>info2</td>
<td>OFF</td>
<td>OFF</td>
</tr>
</tbody>
</table>
的代码是很好,在我的测试工作。你确定你正在使用jquery 1.8+吗? – 2011-06-10 01:17:09
我正在使用1.4.4。选择功能是否比这更新? – 2011-06-10 01:43:37