更改标签(jQuery的)
问题描述:
HTML:更改标签(jQuery的)
<a href="#">Show next element</a>
<div>content</div>
的jQuery:
$('a').toggle(function() {
$(this).next().show();
},
function() {
$(this).next().hide();
});
如何更改jQuery的上方,它也是在链接改变 “显示”“隐藏“元素是否可见?
谢谢!
答
尚未经过测试...
$('a').toggle(function() {
$(this).next().show();
$(this).html("Hide next element");
},
function() {
$(this).next().hide();
$(this).html("Show next element");
});
答
$('a').toggle(function() {
$(this).next().show();
$(this).html('Hide next element');
},
function() {
$(this).next().hide();
$(this).html('Show next element');
});
我想这一个秒前。 .text()更好,不过谢谢! – 3zzy 2010-01-25 06:06:23
伟大的思想家都认为:D – alex 2010-01-25 06:06:30
@Nimbuz .text()仅当您不包括HTML时。 – alex 2010-01-25 06:07:07