Reputation: 31
I have a text file that is modified by different python scripts, and I want to create a jquery function that detects each change in that file and to display that change in an initially empty html div
<div id="logtext"> </div>
using
document.getElementById('logtext').innerHTML= new_content_of_the_file;
( something similar to displaying a logfile ) how can I do that?
Upvotes: 0
Views: 119
Reputation: 44
You can also use HTML like this:
var content = data_from_python;
$("#logtext").html(content);
The difference between HTML and append()
function is that HTML replaces the content of your div
. It's the equivalent of innerHTML
while append
just adds content to the end of an element.
Here is a reference on this topic:
.append()
.html()
Upvotes: 2
Reputation: 674
you can use append or html like this:
$("#logtext").append("to do");
Upvotes: 0
Reputation: 850
Is this what you are looking for?
$('#logtext').append('<p>' + resultMessage + '</p>');
Upvotes: 0