$(".pick_date").AnyTime_picker({ format: "%W, %M %D, %z" });
This is code to initialize AnyTime picker on .pick_date
element. But if I append element then AnyTime doesn't work on it. Is there a way to make it work.
I tried this:
$('#submit-buton').live("click", function() {
$.ajax({
type: "POST",
url: '/AddTask',
dataType: 'html',
success: function(data) {
$("#taskModule").append(data);
$(".pick_date").AnyTime_picker({ format: "%W, %M %D, %z" });
}
});
});
But no effect...
Any idea?
EDIT:
This works:
<div id="mydatepicker">
</div>
<input type="button" id="MyButton" value="Append" />
<script type="text/javascript">
$(function() {
var mydatepickerHtml = 'English: <input type="text" id="field1" size="50" value="Sunday, July 30th in the Year 1967 CE" /><br/>Español: <input type="text" id="field2" value="12:34" />';
$("#mydatepicker").append(mydatepickerHtml);
$('#MyButton').live("click", function() {
// ...
});
AnyTime.picker( "field1", { format: "%W, %M %D in the Year %z %E", firstDOW: 1 } );
$("#field2").AnyTime_picker(
{ format: "%H:%i", labelTitle: "Hora",
labelHour: "Hora", labelMinute: "Minuto" } );
});
</script>
But this doesn't...
<div id="mydatepicker">
</div>
<input type="button" id="MyButton" value="Append" />
<script type="text/javascript">
$(function() {
$('#MyButton').live("click", function() {
var mydatepickerHtml = 'English: <input type="text" id="field1" size="50" value="Sunday, July 30th in the Year 1967 CE" /><br/>Español: <input type="text" id="field2" value="12:34" />';
$("#mydatepicker").append(mydatepickerHtml);
});
AnyTime.picker( "field1", { format: "%W, %M %D in the Year %z %E", firstDOW: 1 } );
$("#field2").AnyTime_picker(
{ format: "%H:%i", labelTitle: "Hora",
labelHour: "Hora", labelMinute: "Minuto" } );
});
</script>