有人可以告诉我这个脚本有什么问题吗
$(this).siblings("property2").hide().child("select").attr("disabled","disabled");
这应该访问单击按钮的同级“property2”并隐藏它。之后它将访问“property2”的子“select”并向“select”添加禁用属性。
但这是行不通的。请帮忙...谢谢!
$(this).siblings("property2").hide().child("select").attr("disabled","disabled");
This is supposed to access the sibling "property2" of a clicked button and hide it. After that it will access the child "select" of "property2" and add a disabled attribute to "select".
But this is not working. Help please ... thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
child
应该替换为children()
如果您使用
property2
那么您正在尝试选择带有标签名称property2
的元素代码>.如果您想通过类名访问,那么它将是.property2
。如果你想删除禁用的属性,那么你可以使用
.removeAttr("disabled")
child
should be replaced withchildren()
If you are using
property2
then you are trying to select elements with tag nameproperty2
. If you want to access by classname then it will be.property2
.If you want to remove the disabled property then you can use
.removeAttr("disabled")
假设
property2
是一个类,并且 select 是该元素的直接后代:Assuming that
property2
is a class, and that the select is a direct descendant of that element:做到了...^^
did it ... ^^