使用 jquery 选择/取消选择所有复选框以及所选行的颜色更改
我有一个表,其中每行都有一些数据,用户可以提交所有行或单行或某些行。所以,现在每一行都有一个复选框,如果用户选中该复选框,则应该更改该行的背景颜色(我已经使用 jquery 实现了这一点)。现在有另一个复选框可以选择所有这些复选框,我也用 jquery 实现了这个。现在的问题是,当我选择所有复选框时,行背景颜色不会更改,但是当我检查各个行时,它会发生更改。作为一名新手编码员,我可以理解点击事件没有发生,因此背景颜色没有改变。所以我使用了change事件而不是click,但它仍然是一样的。选择全部和行背景颜色更改的功能运行良好,但各自独立。需要有关此方面的帮助...
提前致谢, 新手编码员。
I have a table where each row has some data and the user can submit all rows or single row or some rows. So, every row has a checkbox now and If the user checks the checkbox the background colour of this row should be changed(I have implemented this using jquery). Now there is another checkbox to select All these checkboxes, I have implemented this too with jquery. Now the issue is that when I selectAll checkboxes the row background-colour doesnot change , but when I check individual rows it gets changed. Being a novice coder I can understand that click event is not happening so the background colour is not changing. So I have used change event instead of click , but it's still the same. The functions for select All and row background colour change are working good but individually. Need help regarding this...
Thanks in advance,
NoviceCoder.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有你的任何代码我尝试了一些东西。看看您是否可以应用您的代码。 (工作示例)
HTML
CSS
Javascript
Without any of your code I tried something. See if you can apply to your code. (working example)
HTML
CSS
Javascript
这是您的请求的一个简单示例,只需将所有这些代码复制/粘贴到新页面中并运行它。享受
this is a simple example for your request just copy/paste all this code, in new page and run it. Enjoy