首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自动点击页面加载

自动点击页面加载
EN

Stack Overflow用户
提问于 2020-08-09 16:29:44
回答 1查看 67关注 0票数 0

下面提到的代码加载了一个带有“购买篮子”按钮的页面。目前我手动点击按钮来运行代码,任何人都可以在页面加载后添加一个自动点击按钮。我在编码方面是个彻头彻尾的笨蛋。一个完全准备好的代码是必需的。请帮帮忙。

代码语言:javascript
复制
<!-- The basket will be linked to this element's onClick //-->
<button id="custom-button" autofocus >Buy the basket</button>



<!-- Include the plugin //-->
<script src="https://kite.trade/publisher.js?v=3"></script>

<script>
// Only run your custom code once KiteConnect has fully initialised.
// Use KiteConnect.ready() to achieve this.
KiteConnect.ready(function() {
    // Initialize a new Kite instance.
    // You can initialize multiple instances if you need.
    var kite = new KiteConnect("tlhzuxkhbqzcvxrw");

    // Add a stock to the basket
    kite.add({
        "exchange": "NSE",
        "tradingsymbol": "INFY",
        "quantity": 5,
        "transaction_type": "BUY",
        "order_type": "MARKET"
    });


    // Register an (optional) callback.
    kite.finished(function(status, request_token) {
        alert("Finished. Status is " + status);
    });

    // Render the in-built button inside a given target
    kite.renderButton("#default-button");

    // OR, link the basket to any existing element you want
    kite.link("#custom-button");
});
</script>
EN

回答 1

Stack Overflow用户

发布于 2020-08-09 20:19:08

$(window).load(function (){ $("#custom-button").click(); });请在页面加载时给出单击事件。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63324156

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档