Search
 
SCRIPT & CODE EXAMPLE
 

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>
Comment

PREVIOUS NEXT
Code Example
Javascript :: use appsettings.json in console app 
Javascript :: javascript non-repeating randomize array 
Javascript :: how to check if input is string javascript 
Javascript :: fizzbuzz javascript 
Javascript :: javascript download html to pdf 
Javascript :: usestate react 
Javascript :: match 
Javascript :: bootstrap searchable pagination table example jquery 
Javascript :: react check internet connection 
Javascript :: react pass props to children 
Javascript :: javascript export to pdf 
Javascript :: how to use empty href link in reactjs 
Javascript :: model mongoose 
Javascript :: callback function 
Javascript :: how convert string to int javascript 
Javascript :: how assign custom date to input type date in javascript 
Javascript :: javascript speech recognition 
Javascript :: moment 
Javascript :: classic asp get json from url 
Javascript :: jquery find input type password 
Javascript :: express middleware pass parameter 
Javascript :: see vuex values production console 
Javascript :: js some array 
Javascript :: json.stringify pretty 
Javascript :: how to create react native app 
Javascript :: json value types 
Javascript :: carousel react 
Javascript :: counter with react hooks 
Javascript :: system navigation bar react native 
Javascript :: select parent of element jquery 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =