开发者

datepicker in jade template

I'm new to Jade and express and need to add datepicker from jquery UI to one of my layered popup.I have tried inline script and header javascript with onload without any luck.

script(src='/javascripts/jquery-1.4.4.js')
script(src='/javascripts/jquery-ui.js')
script(type='text/javascript')
   function initDate() {
   $('#mdate').datepicker({dateFormat: 'yyyy-mm-dd'});
}

input(type='text', name='mdate', id='mdate')

Any suggestions or help 开发者_运维知识库would be appreciated. Thanks


Try this code instead

script(src='/javascripts/jquery-1.4.4.js')
script(src='/javascripts/jquery-ui.js')
script(type='text/javascript')
   $(function(){
       function initDate() {
          $('#mdate').datepicker({dateFormat: 'yyyy-mm-dd'});
       }
   });

input(type='text', name='mdate', id='mdate')

All I'm doing is telling the page to wait till it's ready before applying the datepicker

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜