Pug Datatables Uncaught ReferenceError: $ is not defined
Pug Datatables Uncaught ReferenceError: $ is not defined
![shi_ro](https://secure.gravatar.com/avatar/8c60f5f18c6fc8f35796167e3071fdda/?default=https%3A%2F%2Fvanillicon.com%2F8c60f5f18c6fc8f35796167e3071fdda_200.png&rating=g&size=120)
Hi,
I am trying to use datatables with pug but * i keep getting an error
Uncaught ReferenceError: $ is not defined
I am using datatables locally and my code looks like this:
extends layout/base
block content
#heading
h1.text-center IL Clients
#content
//- Do it like this...You're already in JavaScript land after the -
- var items = rows
script.
$(document).ready(function() {
$('#resultTable').DataTable({
"order": [[ 0, "desc" ]]
});
});
div
div
table#resultTable.table.thead-light
thead
tr: th Clien Number
th Gender
th Marital Status
th Phone Number
th Group
tbody
each item in items
tr
td=item.clinic_number
td=item.gender
td=item.marital
td=item.phone_no
td=item.group_id
I have also tried moving the js script part below but nothing works. Any advise/recommendations will be appreciated.
This discussion has been closed.
Answers
Perhaps you are not referencing jQuery anywhere.