Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74846

Why doesn't this JS function properly import to my blade.php?

$
0
0

I have a JavaScript file, 'submittedForms.js' that I reference in my blade.php with

<script type="module" src="/js/bundle/charts/submittedForms.js"></script>

In submittedForms.js, I've defined a simple function called 'functionTest' and a variable that represents a chart called 'submittedForms'. I want to import both in my blade.php. The chart variable imports and is rendered fine! However, when I add the function and alter the export to be;

module.exports = {
    functionTest() {
        console.log('this works');
    },
    submittedForms
};

the following error thrown from the blade pops up;

"Uncaught ReferenceError: functionTest is not defined"

In the blade.php I'm calling functionTest like this;

functionTest()

Viewing all articles
Browse latest Browse all 74846

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>