【问题标题】:Auto click on page load自动点击页面加载
【发布时间】:2020-08-09 08:29:43
【问题描述】:

下面提到的代码加载了一个带有购买篮子按钮的页面。 目前我手动点击按钮运行代码 任何人都可以在页面加载后添加自动单击按钮。 我在编码方面完全是个笨蛋。需要一个完全就绪的代码。 请帮忙。

<!-- 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>

【问题讨论】:

  • 按钮的点击事件在哪里?

标签: javascript html onpageloadstring


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    • 2013-05-15
    • 2017-07-10
    • 1970-01-01
    相关资源
    最近更新 更多