我试图将hide()选项添加到已经具有toggle()的div中。因此,当div扩展时,文本足够长,在文本的末尾我想有一个锚点,当单击div以将其隐藏时。我尝试了如下操作,但没有成功。目前,该网站运行良好,但我想添加此功能。 HTML是
$(document).ready(function() {
$('h5').click(function(e) {
$(this).parent().next().toggle();
$(this).parent().next().next().next().toggle();
});
$('h5').click(function(e) {
$(this).find('div.description').hide();
});
});
.description {
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="title">
<h1>14-nov-2019</h1>
<h2>What is Urespray?</h2>
<h5>click for more</h5>
</div>
<div class="description">
<p>text text long text</p>
<h5>Less</h5>
</div>
与此有关的站点位于下面,查找“ Articole tehnice”部分,然后按写有“ click pentru articol”的位置。谢谢 http://agroline.eu/articole-tehnice.html#info-articole