I want to call the jQuery function in HTML using Nunjucks, but it's giving me an error. I have imported the JS file into the HTML file.
Error: Unable to call 'fooName', which is undefined or falsey
Does anyone know why I can't call the function? Here is my code example:
<a class="btn" onclick="{{fooName(test)}}" href="#">Click me!</a>
$(document).ready(() => {
const fooName = (name) => {
console.log(`${this.name}`)
};
});