jQuery end()问题

jQuery end()问题,jquery,Jquery,为什么只有上面的代码才禁用$licensetable中的输入字段?下面的代码不应该是同等的吗 $licensetable .attr({ 'data-productkey': heritageProduct.genericProductKey, 'data-internalid': heritageProduct.internalID }).find('.productname').t

为什么只有上面的代码才禁用
$licensetable
中的输入字段?下面的代码不应该是同等的吗

$licensetable
            .attr({
                'data-productkey': heritageProduct.genericProductKey,
                'data-internalid': heritageProduct.internalID
            }).find('.productname').text(heritageProduct.productName).siblings('.deletesystem').remove();

        $licensetable.find(':input').not(':button').prop('disabled', true);
从:

说明:结束当前链中最近的筛选操作,并将匹配元素集返回到其以前的状态


因此,不,在您的
end()
之后,它将引用
$(.productname)
。尝试
end().end()
(或重构!)。

您需要另一个
.end()

.end()
的文档:


第一个
.end()
返回到
$licensetable.find('.productname')
,第二个返回到
$licensetable

您可以尝试使用jQueryLog检查选择器的情况www.jQueryLog.com我知道了。我会在早些时候禁用它们。我认为结尾总是指向“顶端”。谢谢,还有其他的方法可以到达“顶端”吗?与本例中的parent()与reseact()类似,由于您已将选择器缓存在
$licensetable
中,因此最好使用
.end()
或返回
$licensetable.find(':input')。not(':button')。prop('disabled',true)。使用诸如
parents()
closest()
之类的DOM遍历函数将产生更多的开销。我想你误解了我的问题。我想要的是end()最接近的()版本。但无论如何,谢谢你的帮助:-)
$licensetable
            .attr({
                'data-productkey': heritageProduct.genericProductKey,
                'data-internalid': heritageProduct.internalID
            }).find('.productname').text(heritageProduct.productName).siblings('.deletesystem').remove().end().find(':input').not(':button').prop('disabled', true);
$licensetable
    .attr({
        'data-productkey': heritageProduct.genericProductKey,
        'data-internalid': heritageProduct.internalID
    })
    .find('.productname').text(heritageProduct.productName)
    .siblings('.deletesystem').remove()
    .end()
    .end()
    .find(':input').not(':button').prop('disabled', true);