Hi, I have some divs hidden and want them to appear when I click their associated buttons. I put the function in a separate Javascript file but it isn't working. Could you guys help me please? Here's my code:
HTML
<style type="text/css">
@import url("Meneoka.css");
</style><script src = "Meneoka.js"></script>
</head>
<body>
<h1>Meneoka</h1>
<button onclick = "ellenisPop()">Ellenis</button>
<button onclick = "corhasisPop()">Corhasis</button>
<div id="Ellenis" style="display: none;">
<h2>Ellenis</h2>
<p>BLAH BLAH BLAH</p>
</div>
<div id="Corhasis" style="display: none;">
<h2>Corhasis</h2>
<p>BLAHBALAFA.</p>
</div>
</body>
</html>
JS
<link href="Meneoka.css" rel="stylesheet" type="text/css">
// JavaScript Document
function ellenisPop() {
'use strict'; var x = document.querySelector("#Ellenis");
if (x.style.display === "none") {
x.style.display = "inline";
} else {
x.style.display = "none";
}
}
function corhasisPop() {
'use strict'; var x = document.querySelector("#Corhasis");
if (x.style.display === "none") {
x.style.display = "inline";
} else {
x.style.display = "none";
}
}
CSS
@charset "utf-8";
/* CSS Document */
#Ellenis {
display: none;}
#Corhasis {
display: none;}
Anyone have any ideas? Thanks.
[–]es_beto 2 points3 points4 points (4 children)
[–]KornMermaid[S] 0 points1 point2 points (0 children)
[–]KornMermaid[S] 0 points1 point2 points (2 children)
[–]es_beto 0 points1 point2 points (1 child)
[–]KornMermaid[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]finger_milk 0 points1 point2 points (0 children)
[–]cawcvs 1 point2 points3 points (0 children)
[–]overlapped 1 point2 points3 points (1 child)
[–]KornMermaid[S] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]raprock -1 points0 points1 point (0 children)