MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
cards.forEach(function(card) { | cards.forEach(function(card) { | ||
card.addEventListener('click', function() { | card.addEventListener('click', function() { | ||
// Log a message to the console when a card is clicked | |||
console.log('Card clicked!'); | |||
// Log | |||
console.log(' | |||
}); | }); | ||
}); | }); | ||
}); | }); | ||
Revision as of 10:52, 8 January 2024
// Wait for the DOM to be ready document.addEventListener('DOMContentLoaded', function() { // Get all elements with class "card" var cards = document.querySelectorAll('.card'); // Attach click event listener to each card cards.forEach(function(card) { card.addEventListener('click', function() { // Log a message to the console when a card is clicked console.log('Card clicked!'); }); }); });