V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ThisDay

Materialize 框架里有个 form 按钮 Date Picker 工作不正常

  •  
  •   ThisDay ·
    JustLookAtNow · Jun 24, 2015 · 4350 views
    This topic created in 3961 days ago, the information mentioned may be changed or developed.
    按他描述只需添加一个类datepicker即可
    <input type="date" class="datepicker">
    然而我这边根本没有效果,是不是有什么js没引入呀,小弟做后端的对前端了解不深,请指点
    附我的代码:
    <!DOCTYPE html>
    <html>
    <head>
    <!--Import materialize.css-->
    <link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>

    <!--Let browser know website is optimized for mobile-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <!--<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">-->
    </head>

    <body>
    <!--Import jQuery before materialize.js-->
    <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="js/materialize.min.js"></script>
    <input type="date" class="datepicker">
    </body>
    </html>
    4 replies    2015-06-24 19:28:36 +08:00
    ThisDay
        1
    ThisDay  
    OP
       Jun 24, 2015
    我的(根本没有js加载上)
    他的
    guchengf
        2
    guchengf  
       Jun 24, 2015
    class 是用来判断对象的,需要 js 进行初始化
    $('.datepicker').pickadate({
    selectMonths: true, // Creates a dropdown to control month
    selectYears: 15 // Creates a dropdown of 15 years to control year
    });
    ThisDay
        3
    ThisDay  
    OP
       Jun 24, 2015
    @guchengf 把这两句jq加到前面去了,然并卵呀
    ThisDay
        4
    ThisDay  
    OP
       Jun 24, 2015
    @guchengf 谢谢你可以了,在页面加载后执行这段js初始化就可以了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5590 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 07:02 · PVG 15:02 · LAX 00:02 · JFK 03:02
    ♥ Do have faith in what you're doing.