Although your question looks more like a generic javascript question than WordPress specific and would probably be better suited for another forum like stackoverflow.com, I would say the problem in your code is that you’re using id="countdown"
for all the countdown elements. You should use class="countdown"
if you want to use the element multiple times on a single page. You can also check that you’re getting all the right elements by doing a console.log(elems);
after the document.querySelectorAll
.
Related Posts:
- How to call a PHP function from Javascript in WordPress
- WordPress Infinite Scroll without using any plugin
- How to preserve PHP modifications while upgrading WordPress?
- Calling a method from functions.php on a click of a button
- How to use WordPress (PHP) functions in AngularJS partials files?
- Understanding WordPress child theme custom JS loading
- Click loads template via ajax
- javaScript in section of WP API
- How to speed up admin-ajax.php in wordpress
- Adding tawk.to code just before body tag on functions.php file
- How do I fetch all comments per post via WP REST API?
- Slide in Panel WordPress Post
- How do I display a user’s previous orders as a select box option on a product?
- Trigger popup in a php if/else statement
- Use menu link or onClick to set a variable
- Populate dropdown with Child Pages based on Parent Page chosen
- remove wp floating submenu in wp dashboard
- How to complete two other input fields, completed the first
- JS file work only in index page
- dynamic dependent select dropdown
- Ajax load more button for comments wordpress
- Noscript not working as it should in wordpress site
- Tell WP register script to load a script only when the entire page is loaded
- Why i can’t get custom fields value or post ID via Ajax?
- How to reference PHP in Javascript
- Time Delay a URL Redirect for Specific Page
- WordPress User Meta value variable into Google Gauge Chart
- Cannot find the php_ini configuration file to find my error log to see why my code is not working
- Adding HTML Code to Replace Text in PHP
- Gutenberg block don’t save rich text content
- Trying to add some custom text into WordPress Post title via function.php
- Update $wpdb query with AJAX
- Using Javascript On Page – Header and Footer Now Missing
- Adding extra data to shortcode attributes and pass it to JS with wp_localize_script
- How do I make comment-reply-button with that takes to comment reply form on click
- How to call a function from functions.php with ajax?
- Custom Post type Ajax search results
- WordPress load javascript file if something… (after the page is loaded)
- Automatically refresh page if widget is added to page?
- wordpress all post filter by year
- Find the method which AJAX GET calls
- Display text of price (minus 20%) on every product page in a sentence.
- Help with my first Metabox helper class
- Trouble figuring out how to get my button to submit comment
- how can I make content from a plugin hidden when user is logged in? [duplicate]
- How to hide .js files on wordpress website using php or wp plugins or any? [closed]
- Show Login Errors In WordPress/Elementor (Code “works”, but breaks site)
- hiddenQuestions.find is not a function
- Calling a function via a shortcode in javascript
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)
- Custom PHP contact form issue
- Custom Logo URL | Help me print the URL of the custom logo I inserted into my theme
- Show only IF not Google bot [closed]
- How the functions in WP are called in tags
- admin-ajax.php responding with 0
- Using wp_localize_script to store the template url into a variable to use in JS
- Adding ads code between comments
- How can the plugin directory path be returned into ?
- How to check If Oembed is empty or not
- WordPress Redirect: Default Password Reset URL [duplicate]
- Add before_content and after_content to register_sidebar
- Making Quote Plugin more efficient
- How to access function from outside of a class within this class in WP plugin?
- wrong php date()?
- Sort registered users by post count? (inside admin dashboard)
- How can I add tinymce editor in WordPress with jQuery?
- What is the fastest way to load PHP functions that are only used in one theme template?
- My Own layout in WooCommerce pages [closed]
- Getting rid of role=”navigation” in the Home Page Pagination
- PHP Deprecated: WP_RSSjb has a deprecated constructor
- Include a php file from functions.php only to homepage
- JQuery not working on WordPress Admin page [closed]
- Customizer Show/Hide
- Page Reloads Before AJAX Request Finishes
- Placing raw HTML inside a WordPress shortcode
- Woocommerce – remove product from category
- How to use return in my custom function instead of echo
- Differences when using the the_time and the_date functions
- Create Logout Link WordPress Admin Menu
- Word Count Function Preventing Permalink Editing
- Add a Second Menu to a theme that only support 1 menu
- How to speed up a wordpress function with multiple loops?
- How to Display Image Meta underneath EVERY image in EVERY post
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- Custom excerpt function re-factoring
- How to make custom total price reactive in navigation
- PHP can I add line numbers to file_get_contents()
- How to change a public function inside a class of a plugin?
- get_the_terms – only top level
- syntax issue on php 7.4
- How do I publish only one page to production after making changes on staging?
- Have CSS Class Added with `is_page()` WP function
- Deregistering a script in WordPress seems impossible
- Sending jsPDF documents to the server
- Changing Woocommerce flat rate every nth number of items
- Shortcode content output but not in correct place
- Use wp_get_recent_posts with search term
- How to prevent those PHP variables from being cached on WordPress?
- Convert all images to PNG on file upload
- How to restrict page access to logged-in users?