I've downloaded a calendar script, that when the input element is click a calendar will popup.
<script language="JavaScript">
$(function() {
$( ".datepicker" ).datepicker();
});
</script>
<input class='datepicker' />
The above code works fine.
But when the element is coming from a javascript...
<script language="JavaScript">
function showElement()
{
$('#mydiv').html("<input class='datepicker' />");
}
</script>
<div id='mydiv'></div>
The calendar don't shows up as the input is clicked. I think there is no error in the downloaded script. I think I need to do something to make this calendar appears even if the element is created by a javascript. What should I modify? Thanks!
$( ".datepicker" ).datepicker();has already been called. Maybe you could try calling it again right after creating the input element?