Reputation: 17794
I have a scenario where I have to dynamically add fields on the page through JavaScript.
How can I apply telerik datepicker to dynamically added fields?
I'm using telerik extensions for ASP.net MVC 3.
Upvotes: 2
Views: 1452
Reputation: 63
You can try this for creating a DatePicker
dynamically
var dp = @Html.Telerik().DatePicker().Name("DateCreated").InputHtmlAttributes(new { @class = "FilterDatePicker" });
$("#body").append(dp);
$('.FilterDatePicker').tDatePicker();
Upvotes: 2
Reputation: 30671
You can try this (make sure the required javascript files are included):
$("<input />").appendTo(document.body).tDatePicker();
Upvotes: 4