Skip to content

[Bug] showMovieDetails is undefined #57

@gbowne1

Description

@gbowne1

in movies.mjs,

showMovieDetails() is not defined so we get a

Uncaught ReferenceError: showMovieDetails is not defined
    onclick http://localhost:3000/:1

so this would mean not only is it not defined anywhere, it's not available in the global scope when the user clicked on the Details button available from the movies.mjs file.

Do we,

function showMovieDetails(movieId) {
    console.log("Movie ID:", movieId);
    // your logic here
}
window.showMovieDetails = function(id) {
    // accessible from inline onclick now
};

or something like

document.querySelectorAll('.btn-outline-primary').forEach(btn => {
    btn.addEventListener('click', function() {
        const movieId = this.getAttribute('data-movie-id');
        showMovieDetails(movieId);
    });
});

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions