Aleš Sýkora / September 14, 2021 / 0 comments

How to set scroll to the top with jQuery on click button

Post summary: Create a button and set an ID to it. Then change the #submitButton in code below to your button ID and save. In Oxygen Builder, you can use a code block for this Javascript.

Create a button and set an ID to it. Then change the #submitButton in code below to your button ID and save. In Oxygen Builder, you can use a code block for this Javascript.

jQuery(document).ready(function() {

	jQuery('#submitButton').click(function() {

		 jQuery(window).scrollTop(0);
	});

});

Fuel my passion for writing with a beer🍺

Your support not only makes me drunk but also greatly motivates me to continue creating content that helps. Cheers to more discoveries and shared success. 🍻

0 comments

Share Your Thoughts