简体   繁体   English

在子页面中加载jquery datepicker

[英]load jquery datepicker in subpage

I am trying to load a subpage with a datepicker in a div on my mainpage but my datepicker won't work. 我正在尝试在主页上的div中加载带有日期选择器的子页面,但我的日期选择器将无法工作。

This is my script 这是我的剧本

 $(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();
            });
        }   

The function loadTherapie is called by the onchange event of a select. 通过选择的onchange事件调用loadTherapie函数。

And this is the code on my subpage 这是我子页面上的代码

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

Just change your selector : 只需更改您的选择器:

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();
        });
    }   

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM