Removing <div> if Javascript is disabled

css, javascript, xhtml

Solution

This would work

<div class="hidden">
  <ul>
    <li>Menu Item 1
    <li>Menu Item 2
    <li>Menu Item 3
  </ul>
</div>

.hidden {
  display: none;
}
$(function()
{
  $(".hidden").show();
});

Problem

I have a list that is part of a larger menu: ``` <ul> <li>Menu Item 1</li> <li>Menu Item 2</li> <li>Menu Item 3</li> </ul> ``` I want to hide the list completely IF Javascript is disabled in the web browser. I tried one solution that works, but it uses the noscript element within head, which is not compliant with XHTML. I'm seeking a solution that complies with XHTML.

Original source

Related problems