Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to create onclick event on css class js

<script>
    window.onload = function() {
        var anchors = document.getElementsByTagName('a');
        for(var i = 0; i < anchors.length; i++) {
            var anchor = anchors[i];
            anchor.onclick = function() {
                alert('ho ho ho');
            }
        }
    }
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #create #onclick #event #css #class #js
ADD COMMENT
Topic
Name
4+6 =