There are several questions around similar to this and I have tried all suggestions, to no avail.
I have a text area and a button. The button is initially hidden, but when the user types anything the button is shown.
In addition to this I want to scroll the page so that the button becomes visible. Example:
$(document).ready(function () {
$('#AddCommentEntryBox').on('keyup', function (e) {
if ($(this).val() !== '') {
$('#AddCommentButton').show();
$(window).scrollTop($('#AddCommentButton').position().bottom);
//$("html, body").animate({ scrollTop: $(document).height() }, 1000);
} else {
$('#AddCommentButton').hide();
}
});
});
EDIT: better example - I need to scroll a parent element, not the page: