3👍
Your javascript file is running before the button exists in the DOM, so it can not find it
wrapper your code with use window.onload
whenever you access a DOM element, it must already be rendered
0👍
Perform a null
checker
let button = document.getElementById('id');
if(typeof button !== 'undefined' && button !== null) {
button.onclick = () => { /* Do your stuff */ };
}
- [Django]-Django does not find Pillow though installed
- [Django]-How to use custom django templatetag with django template if statement?
- [Django]-How to create a Django Model with relationships allowing items from a set to be used just once within a container for that set
- [Django]-Django – using regex to strip and replace a urlfield
- [Django]-Django class-based views: Invoking (forwarding to) a different class-based view
- [Django]-Django REST Framework browsable api filter controls not showing
Source:stackexchange.com