在子页面中加载jquery datepicker

时间:2014-12-01 13:13:57

标签: javascript jquery datepicker jquery-ui-datepicker

我正在尝试在主页上的div中加载一个带有日期选择器的子页面,但我的日期选择器无法正常工作。

这是我的剧本

 $(function(){
            $("#datepicker").datepicker();
        });

        function loadTherapie(){
            var therapieID = document.getElementById("lijstTherapieen").value;
            $("#divTherapie").load("wijzigtherapiesubpage.php?therapieID="+therapieID+"&cacheOntloper="+randomNumber()+"&type=2", function(response){
            $(response).find("datepicker").datepicker();
            });
        }   

函数loadTherapie由select的onchange事件调用。

这是我子网页上的代码

<form method="post" action="updateTherapie.php?type=2" name="therapie">     
    <input class="datepicker" type="text" name="txtdatumOpmaak" value="00-00-0000"/>
</form>

1 个答案:

答案 0 :(得分:0)

只需更改选择器:

function loadTherapie(){
        var therapieID = document.getElementById("lijstTherapieen").value;
        $("#divTherapie").load("wijzigtherapiesubpage.php?therapieID="+therapieID+"&cacheOntloper="+randomNumber()+"&type=2", function(response){
        //just mactch all the class datepicker
        $(".datepicker").datepicker();
        });
    }