add class name in html

Solutions on MaxInterview for add class name in html by the best coders in the world

showing results for - "add class name in html"
Camilla
24 Apr 2017
1<script type="text/javascript">
2    function changeClass(){
3        // Code examples from above
4    }
5
6    window.onload = function(){
7        document.getElementById("MyElement").addEventListener( 'click', changeClass);
8    }
9</script>
10...
11<button id="MyElement">My Button</button>
12