gpt4 book ai didi

javascript - 从 TamperMonkey 打开 jQuery Accordion

转载 作者:行者123 更新时间:2023-11-28 04:22:05 24 4
gpt4 key购买 nike

我在页面上有一个 Accordion ,看起来像这样,

<div class="acc-header ui-accordion-header ui-helper-reset ui-state-default ui-accordion-icons ui-corner-all" action="stockexchange.php?ajax=true&amp;step=profile&amp;ID=5" role="tab" id="ui-accordion-1-header-26" aria-controls="ui-accordion-1-panel-26" aria-selected="false" tabindex="0"><span class="ui-accordion-header-icon ui-icon ui-icon-triangle-1-e"></span><span class="ui-accordion-header-icon ui-icon ui-icon-triangle-1-e"></span>
<div class="logo-stock">
<i class="stock-iou-icon"></i>
<!-- <img width="80px" height="60px" src="/images/v2/stock/portfolio_logos/IOU_logo.png?v=1486475443550" /> -->
</div>
<div class="abbr-name d-hide" title="Insured On Us">IOU</div>
<div class="name t-overflow">Insured On Us</div>
<div class="change down">
<i class="arrow-change-icon" role="img" aria-label="stock price is down"></i>
<span class="value">
$0.015 </span>
</div>
<div class="arrow-left">
<div class="t-delimiter d-hide"></div>
<div class="b-delimiter d-hide"></div>
</div>
<div class="price">
<span class="wai t-wai-reset">Stock Price: </span>
$148.33 </div>
<div class="owned">
<span class="wai t-wai-reset">Owned: </span>
0 </div>
<div class="clear"></div>
</div>

我需要使用来自单独页面的 TamperMonkey 脚本打开它。我基本上需要模拟自动点击它,但我不确定该怎么做。

最佳答案

通常您会使用如下所示的 jQuery 代码:

$(".acc-header").click(function(){
//hiding content from id ->content
$("#content").slideToggle();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<h1 class="acc-header">
Click this header!
</h1>

<div id="content">
This text will hide!
</div>

您单击标题,然后内容被隐藏。

关于javascript - 从 TamperMonkey 打开 jQuery Accordion ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42160336/

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