Javascript Get Time Function Not Working

Hi folks,

I’m trying to get the “Start/Resume” button on my Pomodoro Clock to give the current time when pressed, but it is not working…can you give me some help? See jsfiddle here:

Javascript code:



//----------create countdown visual (every 1 second)--------- 

var x = setInterval(function(){
	//get current time when user clicks "Start" button
	//can also use jQuery now method....will try later hahaha

	function myFunction(){
    	var d = new Date();
    	var n = d.getTime();
    	document.getElementById("number").innerHTML = n;

	$(".start-resume").css('cursor', 'pointer').click(function(){



HTML Code (excerpt):


	<div class="bottom-row">
		<div class="start-resume">
		<div class="pause">	
		<div class="stop-reset">

I don’t know what the problem is?

Where are you calling the function that will give you the current time? I recommend you add some console.log statements to you code so that you can see what it is doing.

Hope this points you in the right direction :slight_smile:

PS: you might want to take a look at how ofter your setInterval is running.