I have a button in HTML, and when i press it I want to change the content of a P tag using javascript. The content is in a .txt file (called "myText1.txt" in the same folder as my html file). How can i take that content and save it in a var called fileText, so i can just use document.getElementById("txt_nombre").innerHTML = fileText;
<button id="btn_change" onclick="changeTxt()">OK</button>
<br>
<p id="content"></p>
<script>
function changeTxt() {
var fileText;
document.getElementById("content").innerHTML = fileText;
}
</script>
</body>