I run into a bug/problem when I try the following...
This is the HTML file:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Mathe einfach geübt</title>
<link rel="stylesheet" type="text/css" href="CSS/mathElements.css">
</head>
<?php require("PHP/latex2htmlparser.php"); ?>
<body>
<input type="text" id="tobeformatted" value="">
<button type="button" id="activatebutton" onclick='transform()'>Click Me!</button> <br><br>
<span id="formattedexpression">JavaScript can change HTML content.</span>
<script type="text/javascript" src="js/latex2htmlparser.js"></script>
And this the js
alert("done");
function transform() {
document.getElementById("formattedexpression").innerHTML = "Paragraph changed.";
}
Until here it works (Alert happens and if the button is clicked the text changes)
but when I now add some more functions to the js file it stops working (no alert and no change of text:
alert("done");
function transform() {
document.getElementById("formattedexpression").innerHTML = "Paragraph changed.";
}
function frac() {
document.getElementById("formattedexpression").innerHTML = "Paragraph changed.";
}
function expo() {
document.getElementById("formattedexpression").innerHTML = "Paragraph changed.";
}
function index() {
document.getElementById("formattedexpression").innerHTML = "Paragraph changed.";
}
(the HTML is the same for both files)
Also I have noticed that there are some similar questions (Javascript stops working when I adapt another snippet inside and can more than one function be added in an external javascript file? i.e .js file?) around but they all got downvoted and closed and had no useful solution included. So if this question isn't asked clearly enough, please contact me and I will elaborate.