Search code examples
javascripthtmlnoscript

Is there a HTML opposite to <noscript>?


Is there a tag in HTML that will only display its content if JavaScript is enabled? I know <noscript> works the opposite way around, displaying its HTML content when JavaScript is turned off. But I would like to only display a form on a site if JavaScript is available, telling them why they can't use the form if they don't have it.

The only way I know how to do this is with the document.write(); method in a script tag, and it seems a bit messy for large amounts of HTML.


Solution

  • You could have an invisible div that gets shown via JavaScript when the page loads.