If we need to change the CSS class of a div or any other element with onclick or onmouseover etc. dynamically using JavaScript, you can do so using className. Follow the below example –
Click here to see the class changeMouse over to see the class change