Really simple question for you guys (not so simple for me)
I have put together a script based on other threads here on StackOverflow but I have unique need. There is a form on my site where users will submit it then it will add something like "?updated=555" to the url. However this number changes depending on what they updated.
I need a way to search for just the number (555 in my example) so I can scroll back to that div when the form is submitted and page reloads. Each div has a unique ID with a number that will match that query string when the url is submitted. So all I need is a way to find out what the number is after "?updated=" so I can pass it to this
scrollTop: $("#my-number").offset().top
Here is what I have so far:
<script>
jQuery(document).ready(function($) {
if(window.location.href.indexOf("?updated=") > -1) {
$('html, body').animate({
scrollTop: $("#my-number").offset().top
}, 2000);
}
});
</script>