ashish2py

Css attribute change with javascript

Feb 6th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div id="myElement">Welcome on my site!</div>
  2. <a href="javascript:changeClass()"&gtChange Class</a>
  3. <script language="javascript">
  4. function changeClass(){
  5. document.getElementById("idElement").setAttribute("class", "myClass");
  6. }
  7. </script>
  8.  
  9.  
  10.  
  11. document.getElementById("idElement").setAttribute("class", "className");
  12.  
  13. http://woork.blogspot.in/2008/01/change-class-attribute-using-javascript.html
  14.  
  15. http://stackoverflow.com/questions/7941276/how-to-change-the-class-of-a-div-when-clicking-on-it
  16.  
  17. http://www.ezineasp.net/post/Javascript-Change-Style-Class-of-Div-tag.aspx
Advertisement
Add Comment
Please, Sign In to add comment