1
我使用使用jQuery和HTML代码波纹管膨胀在我的网站崩溃:jQuery中使用HTML扩展崩溃
<script>
$(document).ready(function() {
$('.fulltext').hide();
$('.blog-item .readmore').click(function (event) {
event.preventDefault();
$(this).parent().find('.fulltext').slideToggle('slow');
$(this).text($(this).text() == 'Close Deals' ? 'More Deals' : 'Close Deals');
});
});
</script>
HTML:
<div class="blog-item">
<p class='fulltext'>Read more text will be here.</p>
<a class="readmore" href="#">Read more..</a>
</div>
其实我想用表里面隐藏的文本,其现在是:
但是,当我在全文中使用表停止工作。请提供任何建议。
你应该使用'prev()',而不是'父()找到( '全文');' – iConnor