Currently I have this and it works:
var markup = '<div>';
markup += '<h1>This is a title</h1>';
markup += '<p>This paragraph is really meaningful.</p>';
markup += '</div>';
var div_list = document.getElementById('div_list');
div_list.insertAdjacentHTML('beforeend', markup);
I want to move the markup to an html file (text.html). Then I want to assign the html from that file to a variable in my script.js file. The html file is located in the same folder as my script.js file. The main reason I'm doing this is to separate out my html into a file where I can work in html instead of adding all of the markup in my javascript file.
text.html contains the following:
<div>
<h1>This is a title</h1>
<p>This paragraph is really meaningful.</p>
</div>
I simply want to assign that text to a variable in my script.js file. This way I can do something like
var textFromFile = //whatever I have to do to assign the text from text.html
var div_list = document.getElementById('div_list');
div_list.insertAdjacentHTML('beforeend', textFromFile);