I’m working on a Django project and trying to trigger a jQuery .load() event when an image loads on my webpage. However, the event is not firing as expected. My HTML template uses Django’s {% static %} tag to reference a CSS file, and the image is loaded directly with a relative path (src=”static/p5.jpeg”). The jQuery script is supposed to display an alert when the image finishes loading, but nothing happens. I’m unsure whether the issue lies with how I’m referencing the image, the event binding, or something else.
I tried using jQuery’s .load() event to trigger an alert when an image finishes loading. I expected the alert to display once the image (#img1) was fully loaded. I included the jQuery library from a CDN and wrote the script inside a $(document).ready() function to ensure it runs after the DOM is fully loaded. However, the alert never appears, which suggests that the .load() event isn’t firing as expected. I also double-checked the image path and ensured that jQuery is correctly linked, but the issue persists.