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

razor - Is this a bug in WebMatrix PageData? -

iphone - Requiring the presence of a method in an id -

xslt - Is it possible to select a node that just includes a subset of the child nodes? -