我嘗試做一些代碼與jQuery UI的 即時知道爲什麼它不工作的jQuery UI的日期選擇器沒有出現
我的HTML代碼
<a>open form</a>
<div></div>
我的js代碼是
$(document).ready(function(){
$("a").click(function(){
$.ajax({
url:"data.php",
success:function(data){
$("div").html(data);
}
});
});
})
$(function(){
$("input").on('click', function(){ $(this).datepicker(); });
});
and data.php contains
<input type="text" />
結果是,爲什麼datepicker沒有出現..?
和另外一個問題是這樣的代碼
(document).ready(function(){
$("a").click(function(){
$("div").html("<input id='datepicker'><input id='tb_submit' type='submit' value='Submit' />");
});
})
$(function(){
$("body").on('click', "input#datepicker",function(){ $(this).datepicker(); });
$("body").on('click','input#tb_submit',function(){$(this).button();})
});
的按鈕應該被點擊,則顯示出真正的按鈕。 你有解決方案嗎?
現場代碼:http://jsfiddle.net/5Ps6P/28/
我不明白,爲什麼會出現?我沒有看到任何地方對datepicker的引用.... – RMalke 2013-02-28 01:59:44
對不起,編輯... – 2013-02-28 02:00:47
調用'$(this).datepicker()'不會使datepicker出現,它只是將datepicker綁定到元素。日期選擇器在你點擊元素時出現。 – Barmar 2013-02-28 02:07:47