[英]Auto click on page load
下面提到的代碼加載了一個帶有購買籃子按鈕的頁面。 目前我手動單擊按鈕運行代碼任何人都可以在頁面加載后添加自動單擊按鈕。 我在編碼方面完全愚蠢。 需要一個完全就緒的代碼。 請幫忙。
<!-- 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>
$(window).load(function (){ $("#custom-button").click(); });
請在頁面加載時給出點擊事件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.