English 中文(简体)
如何使用 Javascrip 动态载荷远距日期选手
原标题:How to dynamically load telerik datepicker using javascript

如何以自动方式载运远距约会选手。

我正用 html 文本框 做一个Div标签 并且想着要附加 Tellrik 日期选手 能够做到这一点, 并且可以有人解释我这样做的方法。

<div id="mainDiv"> 
str += <div class="Subdiv" id= ; 
str += data.id +   rel="  + relData +  "><br/>Date Question<br/><label> ; 
str += data.Question + "<br/><input type= textbox  id= Date /></br></br>"; 
str += "<input type= button  value= Submit  onclick= Submitdate("" + data.previousdate+"","" + data.id+ "","" + data.changetype+ "") />"; } $( #Date ).appendTo(document.body).tDatePicker(); 
str +=  </label></div> ; $( #mainDiv ).append(str);  

i 正在获取错误 $( #Date ). appendto( document.body. tDatePicker (); 不是一个函数 。

问题回答

尝试此 :

注册日期选择器客户端库 :

$(Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Add("telerik.common.js").Add("telerik.datepicker.js")))

在窗体上创建输入元素 :

<input id="DatePickerInput" />

然后在网页某处添加以下标注:

$( #DatePickerInput ).appendTo(document.body);
$( #DatePickerInput ).tDatePicker();

$( #DatePickerInput ).appendTo(document.body).tDatePicker();

要设定日期值 :

$( #DatePickerInput ).val( 5/29/2012 );   //Date format may vary, you ll need to adjust it!

祝你好运!

用途 :

var datePicker = $("<input>", { id: "Date", value: "1/1/2013"})
                                                      .appendTo(document.body);
datePicker.tDatePicker();

这应该行得通!





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签