I have the following form. After the search form is submitted and results are returned via an ajax call, I would like the page to jump to an ID - which happens to be the top of the results.
<form class="avail-form">
...
<input type="submit" value="search" />
</form>
<div id="results">Results Found</div>
.
. Results
.
Current attempt that doesn't work.
$(document).ready(function() {
$('form.avail-form').click(function() {
$(this).scrollTop($('#results').offset().top);
});
});
I tried using submit
instead of click
with no luck. I tried a bunch of different apporaches but can't seem to get it right.