javascript - Jquery datepicker is not working on jquery dialog with dynamic contents -
i have 2 jsp pages 1 main.jsp , other dialog.jsp, in main.jsp call java script function openpopup(url, title) open dialog , load content of dialog given url.
here code.
main.jsp
<div id="dialogdiv"></div> <div> <a onclick='openpopup("/web-inf/views/template/dialog.jsp", "add address")' title="add value"></a> </div>
dialog.jsp
<div class="loaddiv"> <form:form method="post" commandname="address" id="dialogform"> <form:input id="livingsince" path="livingsince" cssclass="datepicker"/> </form:form> </div>
common.js
$(function(){ $( ".datepicker" ).datepicker({ changemonth: true, changeyear: true, showbuttonpanel: true, showanim: 'fold' }); }); //for pop function openpopup(url, title) { $("#dialogdiv").load(url + " .loaddiv").dialog({ position: 'center', modal: true, resizable: true, bgiframe: true, autoopen: true, //height: 450, width: 500, title: title, buttons: { save: function () { $("#dialogform").submit(); $("#dialogdiv").dialog('close'); //$("#dialogdiv").html(''); }, cancel: function () { $("#dialogdiv").dialog('close'); } } }); }
problem datepicker not showing on dialog after clicking in input text field. though working on simple jsp page, not on dialog (popup).
try solution not happening me. link
i loading dynamic content well. using time pickers though instead of date pickers. frustrated time pickers not work if loaded content (with time pickers) dynamically.
i solved problem though calling method each time modal loaded. inside method load dynamic content; , (again) re-register time picker. have attached image of code shows how done. working now.
Comments
Post a Comment