title: My jQuery script is not working on my Node.js Express app
body: <p>I'm working on a project with Node.js, Express and MongoDB. I'm having trouble posting my data (comprising of a date and YouTube link) to the database in the format I want it to go in. The database view has a form that allows the user to enter in a date and corresponding link that'll queried below the submission form in a list of entries and in another view which'll grab the link to the YouTube videos. I'm using Twitter Bootstrap to create the views. When I use <code>type="date"</code> the date format used by my browser doesn't correspond with the date format I am using in my MongoDB database. So as a work around I am using jQuery UI to change the date format. But when I try to load the script (I've connected to the static files using app.use <code>('public/js', express.static(path.join(__dirname + 'public/js')));</code> and my script.js file is in the public/js folder but doesn't seem to be running.</p>
  
  <p>This is my app.js code: </p>
  
  <pre><code>var express = require('express');
  var path = require('path');
  var favicon = require('serve-favicon');
  var logger = require('morgan');
  var cookieParser = require('cookie-parser');
  var bodyParser = require('body-parser');
  
  var routes = require('./routes/index');
  var users = require('./routes/users');
  var database = require('./routes/database');
  
  var app = express();
  
  // view engine setup
  app.set('views', path.join(__dirname, 'views'));
  app.set('view engine', 'jade');
  
  // uncomment after placing your favicon in /public
  //app.use(favicon(__dirname + '/public/favicon.ico'));
  app.use(logger('dev'));
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(cookieParser());
  app.use('/public', express.static(__dirname + '/public'));
  app.use(express.static(path.join(__dirname, 'public')));
  app.use('public/js', express.static(path.join(__dirname + 'public/js')));
  app.use('public/css', express.static(path.join(__dirname + 'public/css')));
  
  app.use('/', routes);
  app.use('/users', users);
  app.use('/database', database)
  app.use('/create', database)
  
  // catch 404 and forward to error handler
  app.use(function(req, res, next) {
    var err = new Error('Not Found');
    err.status = 404;
    next(err);
  });
  
  // error handlers
  
  // development error handler
  // will print stacktrace
  if (app.get('env') === 'development') {
    app.use(function(err, req, res, next) {
      res.status(err.status || 500);
      res.render('error', {
        message: err.message,
        error: err
      });
    });
  }
  
  // production error handler
  // no stacktraces leaked to user
  app.use(function(err, req, res, next) {
    res.status(err.status || 500);
    res.render('error', {
      message: err.message,
      error: {}
    });
  });
  
  
  module.exports = app;
  
  app.listen(8080);
  
  console.log("The server has started");
  </code></pre>
  
  <p>And here is my script.js code:</p>
  
  <pre><code>$(document).ready(function() {
      //Date picker jQuery
      $(function() {
          $( ".datepicker" ).datepicker();
          $( "#format" ).change(function() {
            $( ".datepicker" ).datepicker( "option", "dateFormat", $( this ).val() );
          });
        });
      console.log("This worked!!");
  });
  </code></pre>
  
  <p>And here is the code for the view:</p>
  
  <pre><code>extends layout
  
  block content
      .container
        .row
          .col-s-12
            h1 The Mandela Diaries Database
        .row
          .col-s-4
            h3 Add Entry
        .row
          .col-s-12
            form.form-inline(method='post', action='/create')
              .form-group
                label(for='date') Date: 
                input#datepicker.form-control.datepicker(type='text', value='date')
              p
                | Format options:
                br
                select#format
                  option(value='mm/dd/yy') Default - mm/dd/yy
                  option(value='yy-mm-dd') ISO 8601 - yy-mm-dd
                  option(value='d M, y') Short - d M, y
                  option(value='d MM, y') Medium - d MM, y
                  option(value='DD, d MM, yy') Full - DD, d MM, yy
                  option(value="'day' d 'of' MM 'in the year' yy") With text - 'day' d 'of' MM 'in the year' yy
              .form-group
                label(for='link') Link: 
                input#link.form-control(type='string', value='link')
              button.btn.btn-default(type='submit') Submit
        .row
          #entries.col-s-12
            ul
  
            script(type'text/javascript', scrc='../public/js/script.js')
  </code></pre>
  
  <p>And I am using Jade as a template for the HTML.</p>