Javascript - function is not defined using onclick

255 Views Asked by At

I am using browserify to so that I can use the require feature in my javascript. I have a main.js that imports bigchaindb and bip39 using require.

const BigchainDB = require('./bigchaindb-driver')
const bip39 = require('./bip39')

I am using: browserify main.js -o bundle.js to generate the bundle.js file and I am ONLY including this in my index.html.

Last, inside of my index.html I using the onclick attribute to call a function createBook() and getting

createBook function is not defined

, however the function IS defined in my main.js. (Yes, the name is the same)

Index.html:

Script inclusion: <script src="scripts/bundle.js"></script> onclick: <button id="sendButton" onclick="createBook()">Send!</button>

Why am I getting this error?

0

There are 0 best solutions below