Reputation: 63
I have the following javascript that appends a text every second to a DOM
element as follows:
function read(a) {
// htmlEntities(a) returns a text
var attendedStud = htmlEntities(a);
var html = "";
html += "<b>" + htmlEntities(a) + "</b><br>";
$('#result').append(html);
}
For every second, this function read(a) will append text
to the <div id=result>
in the view:
<div>
<button href="#" onclick="load()" @*type="button"*@ class="btn btn-default">
<div id="result" style="overflow-y:scroll"></div>
<br /><br />
<video id="video" width="800" height="600"></video>
<br />
</div>
I have set the styling for <div id="result">
to overflow-y:scroll
so that whenever the function read(a)
appends a text, it will have a scrollbar if the <div id="result">
overflows. However, it does not work and it keeps adding the text to the <div>
without the autoscroll
property. How should I do it?
Upvotes: 0
Views: 48