0👍
It is probably because the javascript is running before the DOM is loaded. ( see Related posts on the right side )
Try running the js inside a function attached to an event listener:
function init() {
// Run your javascript code here
}
// Run the 'init' function when the DOM content is loaded
document.addEventListener("DOMContentLoaded", init, false)
- [Vuejs]-Vue Js While inside the function I called with Axios get, printing the incoming data into the array
- [Vuejs]-Aws amplify update my Vuex state on DynamoDB table update using triggers
Source:stackexchange.com