title: window.scrollTo(0,0) - object is not a function
body: <p>Why am I getting this error?</p>
  
  <p>In console I can place a debugger at the error and type:</p>
  
  <pre><code>window
  Window {top: Window, window: Window, location: Location, external: Object, chrome: Object…}
  window.scrollTo(0,0)
  TypeError: object is not a function
  </code></pre>
  
  <p>Why am I getting an error here? This was working fine the other day.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>(function ($) {
    $(document).ready(function () {
      $('#customer-info-submit').click(function(e){
        e.preventDefault();
        var form = $('form#customer_information');
        var i = 0;
        $.each(required_fields, function(field, response) {
          i++;
          if( '' == $('#'+field).val() ) {
            debugger;
            $(gateway_message).html(response);
            window.scrollTo(0,0);
            return false;
          }
          console.log(i);
          if( i == 9 ) {
            debugger;
          }
          if( i == 12 ) { // 12 is the count of attributes of required fields
            if( !$('#terms_agreement').is(':checked') ) {
  
              $(gateway_message).html('You did not accept the Terms and Conditions.');
              window.scrollTo(0,0);
            } else {
              form.submit();
            }
          }
        });
        return false;
      });
    });
  }(jQuery));
  </code></pre>