1

I've checked other answers on here and I don't think there's one that covers my problem. I am trying to include two JQuery plugins (Datepicker and Select2) and I just want to download them, include them in the head of my site and initiate them in...

$(document).ready(function() {
    // HERE!
    $('[data-toggle="datepicker"]').datepicker();
    $(".js-example-basic-single").select2();
});

...as both suggest I should be able to do... but both give me a ReferenceError: require is not defined in the console and if I go into the .js files and comment out the offending line (as suggested in other answers) the plugin doesn't work at all and I just get an undefined function in the console.

I'm sure this is something simple that's simply outside of my understanding, if anyone can help, that would be great.

This is the head:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">

  <!-- fonts -->
  <link rel="stylesheet" type="text/css" href="/fonts/roboto.css" media="screen" />
  <!-- end fonts -->

  <link rel="stylesheet" type="text/css" href="/css/general.css" media="screen" />
  <link rel="stylesheet" type="text/css" href="/css/message_boxes.css" media="screen" />
  <link rel="stylesheet" type="text/css" href="/css/loading_screen.css" media="screen" />
  <link href="/css/datepicker.css" rel="stylesheet">

  <script type="text/javascript" src="/js/jquery-2.2.4.min.js"></script>
  <script type="text/javascript" src="/js/retina.min.js"></script>
  <script type="text/javascript" src="/js/jscolor.min.js"></script>
  <script type="text/javascript" src="/js/datepicker.js"></script>

  <script type="text/javascript" src="/js/general.js"></script>
  <script type="text/javascript" src="/js/message_boxes.js"></script>
  <script type="text/javascript" src="/js/loading_screen.js"></script>

  <script type="text/javascript" src="/js/tipped.js"></script>
  <link rel="stylesheet" type="text/css" href="/css/tipped.css" />

  <link rel="stylesheet" type="text/css" href="/css/icheck_blue.css" />
  <script type="text/javascript" src="/js/icheck.min.js"></script>

  <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
  <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
</head>
Helen Danger Burns
  • 421
  • 2
  • 9
  • 28

0 Answers0