gpt4 book ai didi

php - anchor 标记在切换 div 中不起作用

转载 作者:行者123 更新时间:2023-11-28 15:46:42 25 4
gpt4 key购买 nike

为什么 anchor 标签不起作用?我有两个 div。当我单击第一个 div 时,会显示第二个 div,但在第一个 div 中 anchor 标记不起作用。

<script>
$('.description').hide();
$('.more').click(function(e){
e.preventDefault();
$(this).closest('.flight-row').find(".description").toggle();
});
</script>
<div id="trips">
<div class="flight-row">
<div class="flight-row-main more">
<div><img src="view/images/user.png" alt="user.png" title="1 traveler" height="15" width="15"></div>
<div class="button"><a href="index.php?act=travelerUserDetail&amp;flightTrainNumber=G8 208&amp;date=2017-01-30" class="btn btn-warning">Choose</a></div>
</div>
<div class="description">
<div class="description-upper-div">
<i class="fa fa-plane" aria-hidden="true"></i>
<span>LKO<i class="fa fa-long-arrow-right" aria-hidden="true"></i>DEL</span>
<span>2017-01-30</span>
</div>
</div>
</div>
<div class="flight-row"></div>
</div>

最佳答案

它工作得很好。建议将脚本放在页面底部。

$('.description').hide();
$('.more').click(function(e){
e.preventDefault();
$(this).closest('.flight-row').find(".description").toggle();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="trips">
<div class="flight-row">
<div class="flight-row-main more">
<div><img src="http://placehold.it/300x200.jpg" alt="user.png" title="1 traveler" height="15" width="15"></div>
<div class="button"><a href="index.php?act=travelerUserDetail&amp;flightTrainNumber=G8 208&amp;date=2017-01-30" class="btn btn-warning">Choose</a></div>
</div>
<div class="description">
<div class="description-upper-div">
<i class="fa fa-plane" aria-hidden="true"></i>
<span>LKO<i class="fa fa-long-arrow-right" aria-hidden="true"></i>DEL</span>
<span>2017-01-30 </span>
</div>
</div>
</div>
<div class="flight-row"></div>
</div>

关于php - anchor 标记在切换 div 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42577874/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com