看下面我想要得到的cnhor元素的值,如果它等于 “指南”启用相应的按钮。 试过以下,但不能让它的工作。:( 有一种感觉,我几乎没有。 感谢如何启用元素使用兄弟姐妹jquery
$("button").siblings("a").each(function() {
var b = $(this).text();
var n = $.trim("Guide");
if ($.trim(b) == n) {
$("button").removeAttr("disabled");
}
<button id="Toggle5" disabled="disabled">
Show </button>
<a href="#" id="docsID5" target="_blank">
Guide
</a>
让我们看看cnhor元素的HTML。 – dotancohen 2012-02-13 07:12:37
你的代码似乎工作正常:http://jsfiddle.net/9gahF/ – 2012-02-13 07:14:58