Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用jquery datepicker获取所选日期的值_Jquery_Jquery Ui_Datepicker_Jquery Ui Datepicker - Fatal编程技术网

如何使用jquery datepicker获取所选日期的值

如何使用jquery datepicker获取所选日期的值,jquery,jquery-ui,datepicker,jquery-ui-datepicker,Jquery,Jquery Ui,Datepicker,Jquery Ui Datepicker,我已经相当成功地使用jQuery日期选择器一段时间了。但是,由于我已经开始向我的站点添加更多功能,我需要对这个功能进行一些扩展。我需要能够获得当前选定日期的值。我的代码如下: $(document).ready(function() { $("#datepicker").datepicker({ dateFormat: "d MM yy", onSelect: function(dateText) {

我已经相当成功地使用jQuery日期选择器一段时间了。但是,由于我已经开始向我的站点添加更多功能,我需要对这个功能进行一些扩展。我需要能够获得当前选定日期的值。我的代码如下:

$(document).ready(function() {
        $("#datepicker").datepicker({
            dateFormat: "d MM yy",
            onSelect: function(dateText) 
            { 
                var url = "schedule_backend.php";
                var league = "I need help";
                var data = "date="+ dateText +"&league="+ league;
                $(".schedule_block").load(url, data);
            }
        });

        $("#division_change").change(function() {
            var url = "schedule_backend.php";
            var league = $('input:radio[name=league]:checked', '#league_form').val();
            var date = "I need help";
            var data = 'date='+ date +'&league='+ league;

            $('.schedule_block').load(url, data);
        });
    });

<div class="schedule_block">

</div>

<div id="datepicker">

</div>

<form id="league_form">
    <h1 style="padding:3px;">
        <input type="radio" checked="true" name="league" value="mlb" id="mlb"/> <img src="/img/misc/mlb.png" width="35" height="35" alt="mlb" title="MLB" class="telephone"/> <span style="color:#090127;font-weight:bold;">MLB</span> <br />
    </h1>
    <h1 style="padding:3px;">
        <input type="radio" name="league" value="nfl" id="nfl"/> <img src="/img/nfl/misc/nfl.png" width="35" height="35" alt="nfl" title="NFL" class="telephone"/> <span style="color:#090127;font-weight:bold;">NFL</span> <br />
    </h1>
    <h1 style="padding:3px;">
        <input type="radio" name="league" value="nba" id="nba"/> <img src="/img/nba/misc/nba.png" width="35" height="35" alt="nfl" title="NBA" class="telephone"/> <span style="color:#090127;font-weight:bold;">NBA</span>
    </h1>
    <h1 style="padding:3px;">
        <input type="radio" name="league" value="ncaa" id="ncaa"/> <img src="/img/ncaa/misc/ncaa.png" width="35" height="35" alt="ncaa" title="NCAA" class="telephone"/> <span style="color:#090127;font-weight:bold;">NCAA</span>
    </h1>
</form>
$(文档).ready(函数(){
$(“#日期选择器”)。日期选择器({
日期格式:“d MM yy”,
onSelect:函数(日期文本)
{ 
var url=“schedule\u backend.php”;
var league=“我需要帮助”;
var data=“date=“+dateText+”&league=“+league;
$(“.schedule_block”).load(url、数据);
}
});
$(“#部门变更”)。变更(功能(){
var url=“schedule\u backend.php”;
var league=$('input:radio[name=league]:选中','#league_form').val();
var date=“我需要帮助”;
变量数据='日期='+日期+'&联盟='+联盟;
$('.schedule_block')。加载(url、数据);
});
});
MLB
NFL
美国篮球职业联盟 NCAA
除了datepicker函数的onSelect选项外,还有其他方法可以获取当前选择的值吗?

请尝试

$('.selector').datepicker({
   onSelect: function(dateText, inst) { ... }
});
检查这个