I'm trying to add a "change log" to my jQuery mobile Application. In case of an error, the user should have the capability, to see what went wrong. Therefor I've implemented a popup, with a textarea (see code below)
<!-- DIALOG Start-->
<div data-role="popup" id="popupLog" data-overlay-theme="a" data-theme="b" style="max-width:400px;" class="ui-corner-all">
<div data-role="header" data-theme="b" class="ui-corner-top">
<h1>Logg-Einträge:</h1>
</div>
<div data-role="none" data-theme="b" class="ui-corner-bottom ui-content">
<textarea style="height: 120px; max-height: 120px" readonly="readonly" data-mini="true" cols="40" rows="8" id="popupTextArea"></textarea>
<a href="#" data-role="button" data-inline="true" id="btn_textArea" data-rel="back" data-theme="c">OK</a>
</div>
</div>
<!-- DIALOG End-->
This popUp is filled with data, and opened when clicking a specific button:
$('#showLog').click(function() {
$("#popupDialog").popup("close");
// populate the textArea with the text
$("#popupTextArea").text(sessionStorage.getItem("logStack"));
// open popUp after a specific time
setTimeout( function(){$('#popupLog').popup('open');
}, 1000 );
});
All functionalities are working fine up to this point. The problem is: When the user scrolls down within the textarea, closes the popUp and re-open it, the position of the scroller is still the same - for example the user scrolls down to the bottom, closes the popUp and reopens it - the popUp will be at the bottom of the textarea again. But i'd like to get allways the top of the textarea, when the popUp is opened again. For realizing this, I've implemented an "Ok"-Button in this popUp as follows, which closes the popUp and set the scrollingTop to 0:
$('#btn_textArea').click(function() {
// Setting position of the textArea to "0" -> But doesn't work.....
$('#popupTextArea').scrollTop(0);
);
});
I'm struggeling at this point, because the appearance of the textArea is still the same. Do I need a refresh or something? I would be very grateful for every help....