html
  • css
  • twitter-bootstrap
  • 2014-02-24 42 views 0 likes 
    0

    我需要創建輸入字段但要日期選擇器,所以我寫這篇文章:引導日曆通話

    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>Untitled Document</title> 
    <script type='text/javascript' src='http://code.jquery.com/jquery-2.1.0.min.js'></script> 
    
         <script type='text/javascript' src='//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js'></script> 
        <link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"> 
          <script type='text/javascript' src='datepicker/js/bootstrap-datepicker.js'></script> 
           <link rel="stylesheet" type="text/css" href="datepicker/css/datepicker.css"> 
    </head> 
    
    <body> 
    <div class="input-append date" id="dp3" data-date="12-02-2012" data-date-format="dd-mm-yyyy"> 
        <input class="span2" size="16" type="text" value="12-02-2012"> 
        <span class="add-on"><i class="icon-th"></i></span> 
    </div> 
    </body> 
    </html> 
    

    ,你可以在這裏看到:http://agroagro.com/test.html

    沒有日期選擇器,只是簡單的輸入字段,也沒有引導樣式

    問題是什麼?

    +0

    喲你永遠不會調用數據閱讀器函數。 –

    回答

    1

    請致電bootstreap像

    <script type="text/javascript"> 
         $(function() { 
         $(".span2").datepicker({ 
          dateFormat: "YYYY-mm-dd", 
          changeMonth: true, 
          changeYear: true, 
         }); 
        }); 
        </script> 
    

    Fiddle

    +0

    我pu,但再次不工作,我會使用HTML 5日期選擇器 – gmaestro

    +0

    @ gmaestro請參閱更新的代碼和小提琴鏈接 – Girish

    +0

    謝謝,這很酷 – gmaestro

    1

    日期選擇器功能,爲什麼不使用默認的HTML5 date屬性和使用form-control類引導像

    <input type = "date" name = "mydate" class = "form-control"> 
    

    fiddle

    +0

    謝謝,不錯,但舊的瀏覽器IE 8,9不會工作那... – gmaestro

    相關問題