javaScript work && !Work

I don’t how to ask this question but I’ll try , i work with pug.js so I mad two pages call it
comment-phone.pug and video.pug and i call comment-phone.pug twice in video.js as you see in photo, but js work with first and don’t work with second?


We need more info. What does “js does not work” mean? What do you expect to see, and what do you actually see? Can you show the other pug file?

What does “js does not work” ? it’s mean work with number one , but not work with number two.

What do you expect to see?

and what do you actually see?

Hmm… so on the phone when you tap “View 59 replies” nothing happens?
Can you show the javascript that’s connected to the component?

It’s difficult to diagnose these things from pictures. Would you be able to post the whole project somewhere, e.g. GitHub? Then I’d gladly take a look.

yes, send me your username on GitHub ,because I make repository privet

My GitHub user name is fkretlow.

I add it , is there any notification on your GitHub,

Yup, will take a look later today if I have the time, or tomorrow.

ya, take your time,this is first time for me to send for someone read my own code

Okay I think I’ve found the issue. You’ve got two instances of the comments section in your page, but you only attach the event listener to the first button.

Take a look at showHiddenReplace in main.js:137. You use querySelector to select the html elements for the event listener, but this way you only get the first match for each query. I think you need to refactor this and use querySelectorAll.

1 Like
A free service run by Zed A. Shaw for