7 votes
0 answers
html - Click on image div should appear JavaScript
Solution:
something like from your code that maybe the blocks has not only one block, so if you just use thequerySelector
, you just select the first element, not all elements
you can use the event capture on elementuspContainer
<script>
var uspContainer = document.querySelectorAll('.uspContainer');
uspContainer.addEventListener("click", (e) => {
if(e.target.classList.contains('uspIcon')){
// so you click the icon
// do your action
}
});
</script>
Undefined asked
Source
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.