Jquery Function Scroll To

Robert Granlund
Robert Granlund used Ask the Experts™
on
I have a JQuery function that closes a <div>
$(document).ready(function() {	
	$('input[type="button"]').click(function() {
		if ($(this).attr("value") == "custom-done") {
			$("#custom-hidden").hide('slow');
		}
	});

HTML:::
<input id="edd-purchase-button" class="edd-submit gray button" type="button" value="custom-done" name="done-customizing">

Open in new window

Currently when I click the button, it scrolls to the bottom of the page.  I want to scroll to the top of the page when I click the button.

Any suggestions?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Expert of the Year 2014
Top Expert 2014
Commented:
For a quick scroll use
          window.scrollTo(0,0)

else using jquery to animate it
           $("html,body").animate({ scrollTop: 0 }, "slow");

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial