javascript Jquery Ui 日期选择器不工作?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19488591/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 15:44:57  来源:igfitidea点击:

Jquery Ui Date Picker Not Working?

javascriptphpjqueryjquery-uidatepicker

提问by

My form code is here.

我的表单代码在这里。

<div class="threeleft second" id='displayallformshow' style="float: none;width: 80%;padding:10px;">
    <form action="investor_submit.php">
        <div class='formdiv'>
            <div style='width:35%;margin-top:12px;'>Published :</div>
            <div style='width:41%;text-align:justify'>
                <div style="float: left;">
                    <input type="radio" name="published" id="" value='publishedyes'>
                </div>
                <div style="float: left;width: 237px;">Yes, allow users who follow links to my venture URL the ability to see my venture page.</div>
                <br>
                <br>
                <div style="float: left;">
                    <input type="radio" name="published" id="" value='publishedno'>
                </div>
                <div style='float: left;width: 237px;'>No, display an error message to anybody who tries to follow links to my venture except for me.</div>
            </div>
        </div>
        <br>
        <br>
        <div class='formdiv'>
            <div style='width:35%;margin-top:12px;'>Listed and Discoverable :</div>
            <div style='width:41%;text-align:justify'>
                <div style='float: left;'>
                    <input type="radio" name="listedanddiscoverable" id="" value='listedanddiscoverableyes'>
                </div>
                <div style='float: left;width: 237px;'>Yes, I want my ventureto be listed in the browser section making it discoverable to RockThePost Visitors. (Required Paid Subscription)</div>
                <br>
                <br>
                <div style='float: left;'>
                    <input type="radio" name="listedanddiscoverable" id="" value='listedanddiscoverableno'>
                </div>
                <div style='float: left;width: 237px;'>No, do not list my venture anywhere automatically. I willmanually invite people to my venture with my venture URL.</div>
            </div>
        </div>
        <div class='formdiv'>
            <div style='width:35%;margin-top:12px;'>Describe Start Date :</div>
            <div style='width:55%;'>
                <input class='madetextboxlong' placeholder="Enter Describe Start Date" type="text" name="describestartdate" id="describestartdate">
            </div>
        </div>
        <div class='formdiv'>
            <div style='width:35%;margin-top:12px;'>Describe end Date :</div>
            <div style='width:55%;'>
                <input class='madetextboxlong' placeholder="Enter Describe end Date" type="text" name="describeenddate" id="describeenddate">
            </div>
        </div>
        <br>
        <br>
        <br>
        <div style="margin-left: 288px;margin-top: 423px;width: 100%;" class="formdiv">
            <input type="submit" id='publishform' class="madebtnsave" name="save" value="Save" />
        </div>
    </form>
</div>

that form i load on click event. user click on investor tab when load.

我在点击事件时加载的那个表格。用户在加载时单击投资者选项卡。

that form is working properly but the problem is not loading the jquery ui datepicker

该表单工作正常,但问题不是加载 jquery ui datepicker

this is my datepicker code.

这是我的日期选择器代码。

$( "#describestartdate" ).datepicker();
$( "#describeenddate" ).datepicker();

Please help me to solve that problem how to working jquery datepicker.

请帮助我解决如何使用 jquery datepicker 的问题。

when i load form without click event the datepicker is display successfully.

当我在没有点击事件的情况下加载表单时,日期选择器显示成功。

but i load form to click event the datepicker is not showing.

但我加载表单以单击日期选择器未显示的事件。

采纳答案by

dear friend try this.

亲爱的朋友试试这个。

$("event tab ID").click(function(){
     $( "#displayallformshow #describestartdate" ).datepicker();
    $( "#displayallformshow #describeenddate" ).datepicker();
});

i hope this is used full for you.

我希望这对你有用。

回答by sebastian_oe

If you load your form on a click event, you have to register the datepickerhandlers

如果您在单击事件上加载表单,则必须注册datepicker处理程序

$( "#describestartdate" ).datepicker();
$( "#describeenddate" ).datepicker();

after having loaded it. Put these line to the end of the form-loading callback (the on-click event). Otherwise, these lines will be executed before the target items are available, i.e. $("#describestartdate")will return an empty list and nothing happens.

加载后。将这些行放在表单加载回调(点击事件)的末尾。否则,这些行将在目标项可用之前执行,$("#describestartdate")即将返回一个空列表并且什么也不会发生。