I am using a script called RecoverScroll which returns the page to its last loaded point when reloaded.

I am using it on a form page, I need it so that...

1. When the page errors and a div with an ID of #error-box is present in the markup the RecoverScroll script is ignored and the page jumps to #error-box (which isn't in the url)

2. alternatively, if I could append #error-box to the url if the #error-box div exists in the markup using js I could use the scripts functionality as intended.

The code to run the script...

Any help will be appreciated, many thanks.