0

I am trying to CSS assigned inside the head tag using JS, its not working for IE any idea why? IE just show "Unknown runtime error".

<html>
<head>
<style id="style_id" type="text/css">
</style>
</head>
<body>
<p>This is the test Text</p>
</body>
<script>
    var st = document.getElementById("style_id");
    st.innerHTML = "p { color:red}";
</script>
</html>
Anil Namde
  • 6,452
  • 11
  • 63
  • 100
  • possible duplicate of [Can jQuery change css style definition? (not individual css of each element)](http://stackoverflow.com/questions/3164740/can-jquery-change-css-style-definition-not-individual-css-of-each-element) – Pekka Oct 25 '10 at 10:33
  • 1
    This is not trivial. See the linked dupe question for a good answer – Pekka Oct 25 '10 at 10:33
  • Not getting..... do you agree with what @Chinmayee's answer? – Anil Namde Oct 25 '10 at 13:24

1 Answers1

0

Are you looking for this one?

Community
  • 1
  • 1
Chinmayee G
  • 7,947
  • 2
  • 31
  • 41