的index.php
<script type="text/javascript">
function new_exp() { $("#quickIndexTab").load("/pages/expenditure/new_exp.php"); }
</script>
<a href="#" onclick="javascript:new_exp()" >List</a>
<div id="quickIndexTab"></div>
new_exp.php
<label>Date picker</label>
<input type="text" id="datepicker" value="" />
刷新new_exp.php时,datepicker无法正常工作且id也无效。
答案 0 :(得分:0)
<script type="text/javascript">
$(function() {
$("#pageLink").on("click",function(e) {
e.preventDefault(); // cancel link
$("#quickIndexTab").load(this.href,function(){
$("#datepicker").datePicker();
});
});
});
</script>
<a id="pageLink" href="/pages/expenditure/new_exp.php">Click</a>