我在每个循环中添加了类hide_some_features,show_some_features。现在我想将feature_suffix的类添加到下一个hide_some_features类中。我尝试使用$(this).closest('.feature_suffix').addClass('test-class');
无效。
$('.variations_form input:radio[name=attribute_pa_1]').each(function() {
if (jQuery.inArray($(this).attr('data-feature-value'), disabledFetaureValue) < 0) {
$(this).closest('.cc-selector').addClass('hide_some_features');
$(this).closest('.feature_suffix').addClass('test-class');
} else {
$(this).closest('.cc-selector').addClass('show_some_features');
}
})
我想将课程添加到突出显示的地方
答案 0 :(得分:2)
myStructList = myStructList.OrderBy(smj => smj.MailID)
.ThenBy(smj => smj.ResendCount)
.ToList();
不会在这里工作,因为目标元素不是触发事件的元素的祖先。使用以下内容:
.closest()
答案 1 :(得分:1)
您可以找到最接近的@XmlRootElement
public class Test {
public void setAge(int age) {
this.age = age;
}
private int age;
private String name;
private Cat cat;
public Test()
{
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public Cat getCat() {
return cat;
}
public void setCat(Cat cat) {
this.cat = cat;
}
}
class Cat
{
private String name="catttttttttttttttt";
public Cat()
{
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
,然后查看它是否有cc-selector
,如果是,则将新类添加到其上一个兄弟
hide_some_features