Javascript auto click button on page load

We taking about auto click on button on page load or any kind of event, then JavaScript will work here. Using this we can operate PHP as well as any Server-Side language but we must be use JavaScript or its Libraries.

Script for javascript auto click button on page load

<!DOCTYPE html>
<html>
<body>

<input type="text" value="0" id="count_id">

<input type="button" value="Click Me" id="button_id" onclick="myFunction()">

<script>
function myFunction() {
	
	var data = document.getElementById("count_id").value;
	var  datacount = (parseInt(data) + 1);
	document.getElementById("count_id").value = datacount;	
	document.getElementById("button_id").value = "Clicked";
	
}
setInterval(function(){
document.getElementById("button_id").click();	
}, 3000);
</script>

</body>
</html>

Result of above program

automatically clicking on button
automatically clicking on button – 1
automatically clicking on button
automatically clicking on button 2

admin

I am a well-organized professional in Drupal Development and PHP web development with strong script handling knowledge or automation process with PHP. I awarded 2 times in year by my company for the best employee of the quarter. I never work to complete my working hours. I worked for only achievement.

This Post Has 2 Comments

  1. Saurabh srivastava

    I really enjoy this auto click. it is very helpful article for me. I appreciate for the same

  2. Pradip Mehta

    Thanks jordan for your great comment.

Comments are closed.