I am trying to create a counter on a page that can increment and decrement by pressing a button. I wrote this HTML code:
<!DOCTYPE html>
<html>
<head>
<title>Space Clicker</title>
</head>
<body>
<script type="text/javascript">
var clicks = 0;
function addIncrement() {
clicks += 1;
document.getElementById("clicks").innerHTML = clicks;
};
var clicks = 0;
function subtractIncrement() {
clicks -= 1;
document.getElementById("clicks").innerHTML = clicks;
};
</script>
<button type="button" id="buttonId" onclick="addIncrement()">+</button>
<button type="button" id="buttonId" onclick="subtractIncrement()">-</button>
<p>Clicks: <a id="clicks">0</a></p>
</body>
</html>
When I run the HTML on an HTML editor, it works exactly as intended, but when I try to run it in the HTML macro, the "+" and "-" buttons display as plain text. How do I fix this?
Okay just figured it out, it was because of the sanitize option
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.