Datepicker Stop Working After Select Data From Autocomplate
i have autocomplate and datepicker in same page. autocomplate work fine. but when after i select data from autocomplate, the datepicker stop working. what should i do ?
algoritm of my aplication :
1. main.php contain autocomplate.
2. user select data from autocomplate
3. main.php will load aEDIT.html that contain datepicker.
this is my code :
main.php
- <html>
<head>
<title></title>
<!-- auto complate-->
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<link rel="stylesheet" href="/resources/demos/style.css" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script type="text/javascript" src="../css/autocomplate/jq-cilbut.js"></script>
<script type='text/javascript' src='../css/autocomplate/jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="../css/autocomplate/jquery.autocomplete.css" />
<script type="text/javascript">
$().ready(function($) {
$("#autocomplate").autocomplete("st-autocomp.php", {width: 512 });
$("#autocomplate").result(function(event, data, kkk) {
$('#autotampil').load('aEDIT.html #calendar'
, function() {
$("#date").datepicker();
});
});
});
</script>
</head>
<body>
<input type="text" id="autocomplate" name="nama" class="form500" placeholder="Nama Pegawai">
<br><br>
<div id="autotampil"></div>
</body>
</html>
aEDIT.html
- <html>
<head>
<title>a.html</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<link rel="stylesheet" href="/resources/demos/style.css" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
</head>
<body>
<div id='calendar'>
<input id="date" type="text" />
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
$("#date").datepicker();
$("#y2").on("click",function(){
alert("clicked data in a.html");
});
});
</script>
st-autocomp.php
- <?php
$q = strtolower($_GET["q"]);
if (!$q) return;
echo "Drs. IMAM THURMUDI,M.Pd.I \n";
echo "Drs. SOLIHAN \n";
echo "H. MUZAJJIN,S.Ag \n";
echo "Drs. H. MOH. ANSHORI \n";
echo "MOH. YANI, S.Ag, MM \n";
echo "MASTUR,S.Ag,M.Pd.I \n";
echo "SUHAIKAH, S.Pd \n";
echo "DIMYATI,S.Ag \n";
echo "Drs. AGUS SANTOSO \n";
echo "M.FADHIL,A.Ma \n";
echo "Drs. ABD. MUNIEF \n";
echo "Dra. SULISTIYOWATI \n";
echo "Dra.SRI LESTARI \n";
echo "JOKO SUPRIYONO, S.Ag \n";
?>
Thanks for Your Help...