|
|
Line 1: |
Line 1: |
| // Wait for the DOM to be ready
| | // Log a message to the console to check if JavaScript is working |
| document.addEventListener('DOMContentLoaded', function() {
| | console.log('JavaScript is working!'); |
| // Log a message to the console
| |
| console.log('JavaScript is working!');
| |
| | |
| // Find all elements with class "card"
| |
| var cards = document.querySelectorAll('.card');
| |
| | |
| // Convert the NodeList to an array for compatibility with older browsers
| |
| var cardsArray = Array.prototype.slice.call(cards);
| |
| | |
| // Log a message if cards are found
| |
| if (cardsArray.length > 0) {
| |
| console.log('Found all cards:', cardsArray);
| |
| } else {
| |
| console.log('No cards found.');
| |
| }
| |
| });
| |