Datepicker doesn't show for externally loaded snippet
Hi,
I am using the datepicker plugin. Here I have 2 files:
myDateInput.html
contains snippet of <input id = datepicker> tag only.
Doesn't contain <html>, <head> nor <body> tags.
Index.html
<script>
$(document).ready(function() {
$( "#datepicker" ).datepicker();
$('#ClickMe').click(function() {
$('#container').load('myDateInput.html');
$( "#datepicker" ).datepicker();
});
});
</script>
In the body, I have
a. 1 <div> id=container
b. 1 button id = ClickMe
c. 2 input boxes,
i) The first input box with id='datepicker'. When I set focus on this box, the datepicker appears. NO problem here.
ii) When I click on the button ClickMe, it will load the myDateInput.html file and put into div id=container. When I set focus to this input box (with ID=datepicker also), the datepicker DOESN'T apper. Can you teach me how to solve this?
I am attaching the 2 files (minus jquery and the datepicker plugin).
Thanks for your help.