我正在使用以下代码,它在我见过的所有浏览器中都能正常工作,IE9 很好,但后来我来到 IE8,它根本不起作用.. 仅供参考,#cal_popup_table
元素被动态添加到页面..
$("#cal_popup_table tbody tr td a").live('click', function() {
$('.datepick-cmd-today').text(from_month + ' ' + from_year);
var test = from_yeartest + '-' + from_monthtest + '-' + from_daytest;
var test_new = test.split("-");
var today = test_new[0] + '-' + test_new[1] + '-' + test_new[2];
$("#arrival").val(today);
});
任何人都可以解释为什么它可能无法正常工作,函数内的代码并不重要,因为一个简单的alert()
也不起作用..点击事件根本不会触发
更新 - 这是插入页面的代码(修剪掉一些内容等)
<div id="cal_popup" class="datepick-popup" style="position: absolute; left: 901px; top: 219px; ">
<div class="datepick" style="width: 195px; ">
<div class="datepick-nav">
<a href="javascript:void(0)" title="Show the previous month" class="datepick-cmd datepick-cmd-prev datepick-disabled"><</a>
<a href="javascript:void(0)" title="Show today's month" class="datepick-cmd datepick-cmd-today ">December 2012</a>
<a href="javascript:void(0)" title="Show the next month" class="datepick-cmd datepick-cmd-next ">></a>
</div>
<div class="datepick-month-row">
<div class="datepick-month">
<table id="cal_popup_table">
<tbody>
<tr>
<td>
<a href="javascript:void(0)" class="datepicker_link dp1354708800000 datepick-today datepick-highlight" title="Select Wednesday, Dec 5, 2012">5</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>