Skip to content

Another Issue in the JS modal button comand  #6

@AbodyHisham

Description

@AbodyHisham

Idk why it gives me this error please help ! the error shown below is (

javascript.js:16

Uncaught TypeError: Cannot read properties of null (reading 'forEach')

at javascript.js:16:11 )

const modalViews = document.querySelector('services__modal');
const modalBtns = document.querySelector('services__button');
const modalClose = document.querySelector('services__modal-close');

let modal = function(modalClick){
modalViews[modalClick].classList.add('active-modal')
}

modalBtns.forEach((mb,i) => {
mb.addEventListener('click' , () => {
modal(i)
})
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions