javascript - How can I write HTML code only if JS is enabled? -


possible duplicate:
is there html opposite noscript

<noscript> makes easy have html code fallback if js disabled... if want have html code shown when scripts enabled? can have js block dynamically writes html, there nicer way using regular html?

let's have link:

<a href="test.com">this should appear if javascript enabed</a> 

use html element style="display:none", set display:block javascript.

sample code (ugly hell, give idea)

<div id="hidethisfromnonjs" style="display:none"> bla bla bla </div>  <script type="text/javascript"> document.getelementbyid('hidethisfromnonjs').style.display='block'; </script> 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -