Hi everyone,

I'm having difficulty getting some javascript to work on my website. What I'm trying to do is get a message to appear on a web page when a drop-down list isn't on the page and to disappear when it is on the page. The drop-down only appears to some users, depending on their customer account status.

This is what I've got so far:

<div style="position:relative;">
<div id="theDiv" style="position:absolute; left:0px; top:0px; z-index:2;">

When the drop-down is on the page, the code appears here. <select class="sortby_select" id="SortBy">....(options)....</select>

<script type="text/javascript">
var writing = document.getElementById("theDiv");
var dropdown = document.getElementById("SortBy");
var selectedText = dropdown.options[dropdown.selectedIndex].text;
if (selectedText == null){
writing.innerHTML = "<p>No products here!</p>";
writing.style.height = "300px";
writing.style.border = "1px solid black";
writing.style.backgroundColor = "#FFFFE0";
writing.style.padding = "40px";

But this doesn't work.
If I change "if (selectedText == null)" to "if (selectedText !== null)" then the message appears on the screen when the drop-down is on the screen—the exact opposite of what I want, so I thought just removing the exclamation mark would switch it around, but no.

Any help with this would be greatly appreciated.