多个按钮功能可使用 javascript 展开和隐藏 div 部分

发布于 2025-01-19 19:45:56 字数 27 浏览 3 评论 0原文

希望每个人在这个有趣的日子(或像我一样令人沮丧的

Hope everyone is having fun on this fun (or frustrating ???? like me) coding day. So, I came across a problem and was hoping someone could help guide me to the right solution. I want to set it so that when I click on the “read more” button, it adds the “active” class and would expand the paragraphs.
I was able to do a loop function for multiple buttons on the page, but when I click on one, it affects all the buttons. I know this is a looping problem but I have not figured out a way to solve it.
What I’m trying to do is basically only have the button I click on add the class, without it working on all the buttons on the webpage. I intend to add more buttons to the page, so if anyone has a better solution or knows of a looping method (cause I’m pretty sure the looping I’m using is the wrong way), please help.
Please see the video for what I mean when I click on one button, both buttons get affected by it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文