Help with appending data from external files with jQuery #146867
Unanswered
Ethan-Mircheff
asked this question in
Programming Help
Replies: 1 comment 3 replies
-
try this $(document).ready(function() {
var paragraph = $("#digits");
var loadFiles = ["digits.html", "digits2.html"];
$.each(loadFiles, function(index, file) {
$.get(file, function(data) {
var tempDiv = $("<div>").html(data);
var textContent = tempDiv.text();
paragraph.append(textContent);
});
});
}); added: var tempDiv = $("<div>").html(data);
var textContent = tempDiv.text();
``` |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Body
I am trying to make a Github pages site that appends the data from several HTML files with jQuery (the files are small now, but they will be a lot bigger in the final version), and it works other than one issue. Right now, there is a gap in the text between the two sources, but what I would like to do is make a single string of all the text so it can be copied and pasted.
Main code:
One of the appended files:
The site on Github pages
Guidelines
Beta Was this translation helpful? Give feedback.
All reactions