我有搜索網站,但我沒有收到線索。我有一個索引頁面JQuery Datepicker在運行時
<script type="text/javascript">
$(document).ready(function($) {
$('.mnclick').click(function() { <-------- when a menu is clicked, i load the data picker.
var target = $(this).attr("id");
$.post("getParam.php",
{
name: target
},
function(data, status) {
$('p#dataz').empty();
$('p#dataz').html(data);
// $('p#dataz').append(data);
// alert("Data: " + data + "\nStatus: " + status);
});
});
$("#datepicker").datepicker();
});
</script>
但不幸的是在運行時加載的datapicker時,在文本框中顯示,但沒有日期選取器顯示的任何干預。
<p id="dataz">
//this is where the data picker will be displayed
</p>
我getparam.php如下:
<?php
$n = $_REQUEST['name'];
$from_to = "<tr>
<td>Date From:</td>
<td>
<script type=text/javascript >
DateInput('txtFrom', true, 'YYYY-M-DD');
</script></td>
</tr>
<tr>
<td>Date To:</td>
<td>
<script type=text/javascript>
DateInput('txtTo', true, 'YYYY-M-DD');
</script>
</td>
</tr>";
if ($n == 'sales_bcbhdhj') {
sales_grossadd();
}
function sales_grossadd() {
global $from_to;
echo "Date: <input type=text class=hasDatepicker id=datepicker />";
}
?>
請幫助我,我堅持
嘗試移動'$(「 #datepicker「).datepicker();'在'click'函數中。 – Joe 2013-05-08 20:45:09