Muhammad Adeel Zahid
Muhammad Adeel Zahid

Reputation: 17794

Adding Telerik Datepicker to Dynamically added form fields

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

Answers (2)

user1103146
user1103146

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

Atanas Korchev
Atanas Korchev

Reputation: 30671

You can try this (make sure the required javascript files are included):

$("<input />").appendTo(document.body).tDatePicker();

Upvotes: 4

Related Questions