title: How can i stop sweetalert scrolling to top after clicking ok?
body: <p>I'm using <a href="https://sweetalert2.github.io" rel="noreferrer">sweetalert2</a> script for when a user posts a comment on my site, It scrolls down to their comment and sweet alert pops up but when they click ok on the sweet alert box it scrolls back upto the top.</p>
  
  <p>From what i've been reading i need some sort of preventdefault or something but i can't figure out where that would go?</p>
  
  <p>Here is my script:</p>
  
  <pre><code>&lt;!-- Sweet alert --&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/6.6.8/sweetalert2.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  window.location.hash = "comment-&lt;?php echo $newcommentid; ?&gt;";
   $(document).ready(function () {
      swal({
                  title: "Comment Posted",
                  text: "Thanks, your comment has now been successfully posted.",
                  type: "success"
              });
   });     
  
  &lt;/script&gt;
  </code></pre>