My button code is:
<button class="button green-btn button--large marg20" onclick="searchMerchant();"> <span class="uppercase trn" data-trn-key="search_restaurant">Search Restaurant</span> </button>
How to autoclick this button on page load. Thanks to everyone.
What you are looking for is probably the document.onload()
-Trigger.
https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onload
document.onload = function() {
searchMerchant();
};
try this code
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
$(window).load(function() {
$(".green-btn").click(function() {
alert("your code or logic goes here on button click");
});
});
</head>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.