Possible Duplicate:
Is there a html opposite to noscript
<noscript>
makes it easy to have HTML code as a fallback if JS is disabled... but what if I want to have HTML code which is only shown when scripts are enabled? I can have a JS block which dynamically writes HTML, but is there a nicer way to do it using some regular HTML?
let's say I have a link:
<a href="test.com">This should only appear if Javascript is enabed</a>
The easy and simple solution is using the HTML “noscript” tag to display different content if JavaScript is disabled. See following full “noscript” example : If JavaScript is disabled : Display warning message and hide the entire content with CSS.
If JavaScript has been disabled within your browser, the content or the functionality of the web page can be limited or unavailable.
The <noscript> tag defines an alternate content to be displayed to users that have disabled scripts in their browser or have a browser that doesn't support script.
Use a HTML element with style="display:none"
, set that to display:block
from JavaScript.
Sample code (ugly as hell, but just to give you the idea)
<div id="hideThisFromNonJs" style="display:none">
Bla bla bla
</div>
<script type="text/javascript">
document.getElementById('hideThisFromNonJs').style.display='block';
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With