I am stuck trying to get a datepicker to work using Jade. Framework is node.js and express.
I load the javascripts in index.jade like this:
link(type='text/css', href='css/ui-lightness/jquery-ui-1.9.1.custom.min.css', rel='stylesheet')
script(src='js/jquery-1.8.2.js', type='text/javascript')
script(src='js/jquery-ui-1.9.1.custom.min.js', type='text/javascript')
script(src='js/i18n/jquery-ui-i18n.min.js', type='text/javascript')
I have tried several ways of using these javascripts in code beneath, but there must be something I am missing. I found these lines of code on the same spot i found the referance to the jQuery libraries:
$(function(){
$.datepicker.setDefaults(
$.extend($.datepicker.regional[""])
);
$("#datepicker").datepicker();
});
How can I express or use that in Jade?
Thanks for any answers.
This should work as your template (assuming you have the css/js files installed and they can be loaded properly):
!!!5
html
head
link(type='text/css', href='css/ui-lightness/jquery-ui-1.9.1.custom.min.css', rel='stylesheet')
script(src='js/jquery-1.8.2.js', type='text/javascript')
script(src='js/jquery-ui-1.9.1.custom.min.js', type='text/javascript')
script(src='js/i18n/jquery-ui-i18n.min.js', type='text/javascript')
script
$(function() {
$.datepicker.setDefaults(
$.extend($.datepicker.regional[""])
);
$("#datepicker").datepicker();
});
body
#datepicker