If width of the device visiting my site is <320 I want a <h3>
to be removed. This is what I've tried with:
HTML:
<head>
<script type="text/javascript" src="javascript.js"></script>
</head>
<body>
<h3 id="title">Title</h3>
</body>
JavaScript:
if (document.documentElement.clientWidth <= 320) {
document.write("Testing");
var h3 = document.getElementById("title");
h3.parentNode.removeChild(h3);
}
The "testing" label is printed on the screen but the <h3>
is still there. What's wrong?