Datepicker麻烦

时间:2015-04-23 08:18:45

标签: jquery html css twitter-bootstrap datepicker

嗨,我不能让这个日期选择器工作?有人可以帮助我让它工作,当我点击它时,它会做任何事情!

这是来自这个网站,我试图做出他们的榜样。

链接:http://jsfiddle.net/jasenhk/4g9u5/

HEAD:

<head>

<!--Bootstrap stylesheet-->
<link rel="stylesheet" href="css/bootstrap.min.css">

<!--Bootstrap scripts-->
<script src="js/bootstrap.min.js" type="text/javascript"></script>



<!--Custom stylesheets-->
<link rel="stylesheet" type="text/css" href="css/style.css">

<!--Custom scripts-->
<script src="http://code.jquery.com/jquery-latest.min.js"</script>

<script>
$(document).ready(function() {
    $(".date-picker").datepicker();

    $(".date-picker").on("change", function () {
        var id = $(this).attr("id");
        var val = $("label[for='" + id + "']").text();
        $("#msg").text(val + " changed");
    });
});
</script>
</head>

BODY:

<div class="controls">
    <div class="input-group">
    <label for="date-picker-3" class="input-group-addon btn">
        <span class="glyphicon glyphicon-calendar"></span>
    </label>
    <input id="date-picker-3" type="text" class="date-picker form-control 
hasDatepicker">
    </div>
</div>

1 个答案:

答案 0 :(得分:2)

您必须从输入中删除font-icon类。您的HTML格式也不正确:

<lable>

您的jQuery脚本标记也格式错误:

private static Process lastStartedProcess;
    private static void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)//Méthode qui s'active lorsque l'ordi reconnait la phrase
    {



        if (e.Result.Text == "test")//e.Result contains the recognized text
        {
            Console.WriteLine("The test was successful");
        }

        else if (e.Result.Text == "exit")
        {
            _completed.Set(); //Calling the Set method will end the program
        }

        else if (e.Result.Text == " music")
        {
           lastStartedProcess = Process.Start(@"C:\Users\Public\Music\Sample Music\");
        }

        else if (e.Result.Text == " Pictures")
        {
           lastStartedProcess = Process.Start(@"C:\Users\Public\Pictures\Sample Pictures\Desert.jpg");//En appelant music, j'affecte le process music a ma variable process

        }

        else if (e.Result.Text == " Movies")
        {
           lastStartedProcess = Process.Start(@"C:\Users\Public\Videos\Sample Videos\Wildlife.wmv");

        }

        else if (e.Result.Text == "Close")
        {
            if (lastStartedProcess != null)
            {

                lastStartedProcess.CloseMainWindow();//Ici je ferme le process qui est present dans ma variable process en appelant CloseMainWindow
                lastStartedProcess.WaitForExit();
            }

        }

    }

你错过了jQuery UI:

hasDatepicker

以下是jsfiddle工作示例:http://jsfiddle.net/054xstp5/15/