Open ShriwasAshwin007 opened 9 years ago
In jquery.timepicker.js line number 394
widget.viewport.children().detach();
Here it is giving error below error:
Uncaught TypeError: Cannot read property 'children' of undefined $.TimePicker.open $.extend.open (anonymous function) c.event.handle h.handle.o
Issue: I have MVC webgrid in that I have one link on click of that I open one Modal Pop using below code $(".openPlanScreenDialog").live("click", function (e) { e.stopImmediatePropagation(); e.preventDefault();
')$('
.addClass("dialog")
.attr("id", $(this) .attr("data-dialog-id")) .appendTo("body") .effect("slide", {}, 2000) .dialog({ title: $(this).attr("data-dialog-title"),
modal: true, height: 950, width: 1100, center: 0, hide: { effect: "explode", duration: 1000 }, close: function (event, ui) { $(this).empty(); $(this).dialog("destroy");
} }) .load(this.href); });
First time when modal pop up open the timepicker plugin works fine and show the times. After that I close my modal popup and re-open the modal popup timepicker plugin is not working i.e. it does not show me the times in textbox when i click.
After analyzing I came to conclusion somehow the plugin is not getting destroyed or re-initialized to its initial stage. I tried below things on document ready function of jquery but still no luck :
$('#StartTime').timepicker('destroy'); $(document).ready(function(){ $('input.timepicker').timepicker({}); });
When I inspect the element second time I get below error message in console:
Uncaught TypeError: Cannot read property 'children' of undefined $.TimePicker.open $.extend.open (anonymous function) c.event.handle h.handle.o
Below is the image:
Below is the Timepicker Jquery code which I am using in my partial view:
Note : #StartDate and #EndDate are two text boxes in my HTML form