Change div element color - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Div


Change div element color

Demo Code

ResultView the demo in separate window

      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <div onclick=" = 'red'">
          Change color with inline javascript 
      <div onclick="changeColor(this)">
          Change color with javascript function 
   function changeColor(element){ = 'blue';

   </body>/*w  w w .j  a  va 2  s .  c o m*/

Related Tutorials