0
$(this).siblings("property2").hide().child("select").attr("disabled","disabled");

这应该访问单击按钮的同级“property2”并将其隐藏。之后它将访问“property2”的子“select”并将禁用属性添加到“select”。

但这不起作用。请帮助...谢谢!

4

3 回答 3

1
$(this).siblings(".property2").hide().children("select").attr("disabled","disabled");
  1. child应该替换为children()

如果您正在使用,property2那么您正在尝试选择带有标签 name 的元素property2。如果你想通过类名访问,那么它将是.property2.

如果要删除 disabled 属性,则可以使用.removeAttr("disabled")

于 2010-12-09T05:31:36.180 回答
0

假设这property2是一个类,并且 select 是该元素的直接后代:

$(this)
    .siblings('.property2')
    .hide()
    .children("select")
    .attr("disabled","disabled");
于 2010-12-09T05:31:16.620 回答
0
$(this).siblings(".property2").hide().children().attr("disabled","disabled");

做到了……^^

于 2010-12-09T05:31:25.700 回答