简体   繁体   English

我们如何将datepicker初始化到由ajax附加的文本框中

[英]How can we initialise datepicker into a textbox which is appended by ajax

In yii framework of PHP I'm trying to append a textbox then initialise the datepicker. 在PHP的yii框架中,我尝试附加一个文本框,然后初始化datepicker。 I already have two static textbox with datepicker working fine in the from and two more needed to be added and datepicker be initialised in those textbox. 我已经有两个静态文本框,且datepicker在from中运行良好,还需要添加两个静态文本框,并在这些文本框中初始化datepicker。

When I'm trying to initalise after ajax success call. 当我尝试在ajax成功调用之后启动程序时。 It is showing 它显示

datepicker is not a function 日期选择器不是功能

My ajax call : 我的ajax电话:

$.ajax({
            type: 'get',
            url: url,
            cache: false,
            dataType: 'html',
            success: function (html) {
                $('.append_more_parents:last').append(html);
                var num_form = parseInt($('.count').length + 2);
                $('.count:last').text('Parental Responsibility ' + num_form);
                $form = $('#appended_form');
                $form.replaceWith($form.html());
                container_id++;
                $('#datepicker').datepicker();
            },
            error: function (err) {
                bootbox.alert('Sorry adding of parental details failed! Please try again');
            }
});

如果显示“ datepicker不是函数”,似乎HTML页面中不包含Jquery datepicker库?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 jQuery datepicker-如何在datepicker文本框中隐藏文本? - Jquery datepicker - How do we hide the text inside a datepicker textbox? 如何将文本框放在表数据中,哪些行已从另一表追加/移动? - How can I put a textbox inside a table data which rows have been appended/moved from another table? Fuelux datepicker如何初始化它? - Fuelux datepicker how do I initialise it? 我们如何为循环创建的多个文本框赋予相同的名称 - How we can give same name to the multiple textbox which are created by a loop 一旦所有请求完成,我们如何确定哪个ajax因多个ajax请求而失败? - how can we identify which ajax failed with multiple ajax requests once all the requests are completed? 如何验证Webform中的文本框输入? - how we can validate a textbox input in webform? 我们如何将文本框的值设置为下拉列表? - how can we set textbox value to dropdownlist? 如何通过将数据保存在附加文本框中来解决问题 - how to solve theproblem with saving the data in an appended textbox 我如何创建文本框,可以使用Asp.net mvc4中的jquery ajax在数据库中保存任何输入 - how can i create textbox which can save any input in database using jquery ajax in Asp.net mvc4 如何更改使用ajax调用附加的html输入的span值? - How to change span value from a html input which has been appended using ajax call?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM