gpt4 book ai didi

javascript - 在按钮或 div 外部单击时隐藏按钮

转载 作者:太空宇宙 更新时间:2023-11-03 19:56:15 26 4
gpt4 key购买 nike

我想在按钮外点击时隐藏一个按钮。

HTML :

<div style="background:#FF0000;">

<div style="vertical-align:middle; text-align:center; padding:50px;">

<button name="Submit" type="submit" class="social_button_area_post" title=" Share Your Flow ">
<i class="fa fa-share-alt-square"></i> Video
</button>

<button name="Submit" type="submit" class="social_button_area_post" title=" Share Your Flow " id="hidethisbutton">
<i class="fa fa-share-alt-square"></i> Post
</button>

<button name="Submit" type="submit" class="social_button_area_post" title=" Share Your Flow ">
<i class="fa fa-share-alt-square"></i> Photo
</button>

</div>

</div>

最佳答案

$(document).ready(function() {
$(document).click(function() {
$("#hidethisbutton").hide();
})

$("#hidethisbutton").click(function() {
return false;
})
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div style="background:#FF0000;">

<div style="vertical-align:middle; text-align:center; padding:50px;">

<button name="Submit" type="submit" class="social_button_area_post" title=" Share Your Flow ">
<i class="fa fa-share-alt-square"></i> Video
</button>

<button name="Submit" type="submit" class="social_button_area_post" title=" Share Your Flow " id="hidethisbutton">
<i class="fa fa-share-alt-square"></i> Post
</button>

<button name="Submit" type="submit" class="social_button_area_post" title=" Share Your Flow ">
<i class="fa fa-share-alt-square"></i> Photo
</button>

</div>

</div>

关于javascript - 在按钮或 div 外部单击时隐藏按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42107398/

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