javascript - datetimepicker does not appear for dynamically created field in phonegap android -


i creating input field dynamically display datetimepicker.when create field in body , give class='datetimepicker' display datepicker in app when tried create field dynamically , give class name datetimepicker doesnot display datepicker can 1 tell me whats issue. here code date time picker:

var input_date=$(document.createelement('input')).attr('id','brthdate');     input_date.attr('class','datetimepicker');     input_date.attr('onclick','displaydate()');     input_date.attr('type','text');     input_date.appendto('#contentdemo'); $('#demopage').trigger('create'); function displaydate(){ $("#brthdate").datetimepicker();} 

here list of js files used datetimepicker:

jquery.mobile-1.3.1.min.css"  mobiscroll.css"  jquery.js jquery-ui.js jquery.mobile-1.3.1.min.js  jquery-ui-timepicker-addon.js  mobiscroll.js application.js 

try like

var input_date=$(document.createelement('input')).attr('id','brthdate'); input_date.attr('class','datetimepicker');  //input_date.attr('onclick','displaydate()'); $("#brthdate").datetimepicker();  input_date.attr('type','text'); input_date.appendto('#contentdemo'); $('#demopage').trigger('create'); 

or directly use class name on dom ready like

$(document).ready(function(){     $('.datetimepicker').datetimepicker(); }); 

and create new element


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -