- Joined
 - Sep 12, 2016
 
- Messages
 - 28
 
- Likes
 - 4
 
- Degree
 - 0
 
Hi, i'm trying to add a script to my checkout page only but can't make it work, the time doesn't appear and also don't know if the script is running
Here's what I did:
1) Added to the page as text:
	
	
	
		
2) Created a checkout-countdown.js in /wp-content/themes/mytheme/assets/js and inside pasted this script:
	
	
	
		
3) Added this code to my child functions.php
	
	
	
		
* 7 is the ID of my checkout page
What's the issue? Let me know Thanks!
				
			Here's what I did:
1) Added to the page as text:
		Code:
	
	<div>Registration closes in <span id="timedown"></span> minutes!</div>
Registration closes in <span id="timedown"></span> minutes!
	
		Code:
	
	window.onload = function () {
    var display1 = document.querySelector('#timedown'),
        timer1 = new CountDownTimer(600);
    timer1.onTick(format(display1)).start();
    function format(display) {
        return function (minutes, seconds) {
            minutes = minutes < 10 ? "0" + minutes : minutes;
            seconds = seconds < 10 ? "0" + seconds : seconds;
            display.textContent = minutes + ':' + seconds;
        };
    }
};
	
		Code:
	
	function add_countdown() {
    if ( is_page(7) ) {           
        wp_enqueue_script( 'checkout-countdown', get_stylesheet_directory_uri() . '/js/checkout-countdown.js', array('jquery'));
}   
}
add_action( 'wp_enqueue_scripts', 'add_countdown' );
	What's the issue? Let me know Thanks!