Cannot read property 'toFixed' of undefined. Uncaught TypeErrorDetecting an undefined object propertyFrame Buster Buster … buster code neededExplain the encapsulated anonymous function syntaxGoogle MAP API Uncaught TypeError: Cannot read property 'offsetWidth' of nullUncaught TypeError: Cannot read property 'msie' of undefinedUncaught TypeError: Cannot read property 'msie' of undefined - jQuery toolsReactJS - Does render get called any time “setState” is called?Datatables: Cannot read property 'mData' of undefinedReact - uncaught TypeError: Cannot read property 'setState' of undefinedUncaught TypeError: Cannot read property 'isHit' of undefined

“all of who” or “all of whom”?

Do universities maintain secret textbooks?

Storing milk for long periods of time

Group riding etiquette

What caused the end of cybernetic implants?

Fixing a blind bolt hole when the first 2-3 threads are ruined?

What is the motivation behind designing a control stick that does not move?

How to differentiate between two people with the same name in a story?

German equivalent to "going down the rabbit hole"

What's the difference between a variable and a memory location?

Lob Logical Read and lob read-ahead reads in NCCI

How do I portray irrational anger in first person?

What am I looking at here at Google Sky?

What is a "hashed transaction" in SQL Server Replication terminology?

Unexpected behavior after assignment of function object to function wrapper

IList<T> implementation

An ant walks on a cube over the diagonals of little cubes. Can it visit all little faces exactly once?

How do I get my neighbour to stop disturbing with loud music?

How to get a B2B company to take chances on their image?

What's the origin of the concept of alternate dimensions/realities?

Can copper pour be used as an alternative to large traces?

Ask one verbal question to figure out who is blind and who is mute among three persons

Is "prohibition against," a double negative?

Why is there no Disney logo in MCU movies?



Cannot read property 'toFixed' of undefined. Uncaught TypeError


Detecting an undefined object propertyFrame Buster Buster … buster code neededExplain the encapsulated anonymous function syntaxGoogle MAP API Uncaught TypeError: Cannot read property 'offsetWidth' of nullUncaught TypeError: Cannot read property 'msie' of undefinedUncaught TypeError: Cannot read property 'msie' of undefined - jQuery toolsReactJS - Does render get called any time “setState” is called?Datatables: Cannot read property 'mData' of undefinedReact - uncaught TypeError: Cannot read property 'setState' of undefinedUncaught TypeError: Cannot read property 'isHit' of undefined






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I'm trying to understand why my code block doesn't work. I am using JQuery as well as vanilla JS.



Here's my code.



 // update every 1 second on time.
setInterval(function()
// get current time and duration of entire video
let getTimePaused = video.currentTime;
let vidTime = getTimePaused.toFixed(0);
let formatTime = minTommss(vidTime);
$(".timeLeft").text(
minTommss(vidTime / 60) + " - " + minTommss((video.duration / 60) + 0.01)
);
, 1000);


Any help is much appreciated.



Thanks!










share|improve this question
























  • Do you understand what the error means? What is the value of video?

    – Felix Kling
    Mar 27 at 23:03












  • Please post the rest of your code,

    – Jack Bashford
    Mar 27 at 23:04











  • @FelixKling I do understand it. However, I'm not sure why I'm getting it. Is it because I need to parseInt something?

    – Cazador Shaw
    Mar 27 at 23:05











  • You code doesn't show where video comes from at all, you're not passing it into the function, so why would anyone (including you) assume that video.currentTime exists as a value?

    – Mike 'Pomax' Kamermans
    Mar 27 at 23:06







  • 1





    "Is it because I need to parseInt something?" No. The error means that video is a value that doesn't have a property currentTime. The fix is to either make sure that video is the value you need or to access the correct property. There is not much more we can say about it without having more context.

    – Felix Kling
    Mar 27 at 23:07


















1















I'm trying to understand why my code block doesn't work. I am using JQuery as well as vanilla JS.



Here's my code.



 // update every 1 second on time.
setInterval(function()
// get current time and duration of entire video
let getTimePaused = video.currentTime;
let vidTime = getTimePaused.toFixed(0);
let formatTime = minTommss(vidTime);
$(".timeLeft").text(
minTommss(vidTime / 60) + " - " + minTommss((video.duration / 60) + 0.01)
);
, 1000);


Any help is much appreciated.



Thanks!










share|improve this question
























  • Do you understand what the error means? What is the value of video?

    – Felix Kling
    Mar 27 at 23:03












  • Please post the rest of your code,

    – Jack Bashford
    Mar 27 at 23:04











  • @FelixKling I do understand it. However, I'm not sure why I'm getting it. Is it because I need to parseInt something?

    – Cazador Shaw
    Mar 27 at 23:05











  • You code doesn't show where video comes from at all, you're not passing it into the function, so why would anyone (including you) assume that video.currentTime exists as a value?

    – Mike 'Pomax' Kamermans
    Mar 27 at 23:06







  • 1





    "Is it because I need to parseInt something?" No. The error means that video is a value that doesn't have a property currentTime. The fix is to either make sure that video is the value you need or to access the correct property. There is not much more we can say about it without having more context.

    – Felix Kling
    Mar 27 at 23:07














1












1








1








I'm trying to understand why my code block doesn't work. I am using JQuery as well as vanilla JS.



Here's my code.



 // update every 1 second on time.
setInterval(function()
// get current time and duration of entire video
let getTimePaused = video.currentTime;
let vidTime = getTimePaused.toFixed(0);
let formatTime = minTommss(vidTime);
$(".timeLeft").text(
minTommss(vidTime / 60) + " - " + minTommss((video.duration / 60) + 0.01)
);
, 1000);


Any help is much appreciated.



Thanks!










share|improve this question














I'm trying to understand why my code block doesn't work. I am using JQuery as well as vanilla JS.



Here's my code.



 // update every 1 second on time.
setInterval(function()
// get current time and duration of entire video
let getTimePaused = video.currentTime;
let vidTime = getTimePaused.toFixed(0);
let formatTime = minTommss(vidTime);
$(".timeLeft").text(
minTommss(vidTime / 60) + " - " + minTommss((video.duration / 60) + 0.01)
);
, 1000);


Any help is much appreciated.



Thanks!







javascript jquery






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 23:03









Cazador ShawCazador Shaw

1379 bronze badges




1379 bronze badges















  • Do you understand what the error means? What is the value of video?

    – Felix Kling
    Mar 27 at 23:03












  • Please post the rest of your code,

    – Jack Bashford
    Mar 27 at 23:04











  • @FelixKling I do understand it. However, I'm not sure why I'm getting it. Is it because I need to parseInt something?

    – Cazador Shaw
    Mar 27 at 23:05











  • You code doesn't show where video comes from at all, you're not passing it into the function, so why would anyone (including you) assume that video.currentTime exists as a value?

    – Mike 'Pomax' Kamermans
    Mar 27 at 23:06







  • 1





    "Is it because I need to parseInt something?" No. The error means that video is a value that doesn't have a property currentTime. The fix is to either make sure that video is the value you need or to access the correct property. There is not much more we can say about it without having more context.

    – Felix Kling
    Mar 27 at 23:07


















  • Do you understand what the error means? What is the value of video?

    – Felix Kling
    Mar 27 at 23:03












  • Please post the rest of your code,

    – Jack Bashford
    Mar 27 at 23:04











  • @FelixKling I do understand it. However, I'm not sure why I'm getting it. Is it because I need to parseInt something?

    – Cazador Shaw
    Mar 27 at 23:05











  • You code doesn't show where video comes from at all, you're not passing it into the function, so why would anyone (including you) assume that video.currentTime exists as a value?

    – Mike 'Pomax' Kamermans
    Mar 27 at 23:06







  • 1





    "Is it because I need to parseInt something?" No. The error means that video is a value that doesn't have a property currentTime. The fix is to either make sure that video is the value you need or to access the correct property. There is not much more we can say about it without having more context.

    – Felix Kling
    Mar 27 at 23:07

















Do you understand what the error means? What is the value of video?

– Felix Kling
Mar 27 at 23:03






Do you understand what the error means? What is the value of video?

– Felix Kling
Mar 27 at 23:03














Please post the rest of your code,

– Jack Bashford
Mar 27 at 23:04





Please post the rest of your code,

– Jack Bashford
Mar 27 at 23:04













@FelixKling I do understand it. However, I'm not sure why I'm getting it. Is it because I need to parseInt something?

– Cazador Shaw
Mar 27 at 23:05





@FelixKling I do understand it. However, I'm not sure why I'm getting it. Is it because I need to parseInt something?

– Cazador Shaw
Mar 27 at 23:05













You code doesn't show where video comes from at all, you're not passing it into the function, so why would anyone (including you) assume that video.currentTime exists as a value?

– Mike 'Pomax' Kamermans
Mar 27 at 23:06






You code doesn't show where video comes from at all, you're not passing it into the function, so why would anyone (including you) assume that video.currentTime exists as a value?

– Mike 'Pomax' Kamermans
Mar 27 at 23:06





1




1





"Is it because I need to parseInt something?" No. The error means that video is a value that doesn't have a property currentTime. The fix is to either make sure that video is the value you need or to access the correct property. There is not much more we can say about it without having more context.

– Felix Kling
Mar 27 at 23:07






"Is it because I need to parseInt something?" No. The error means that video is a value that doesn't have a property currentTime. The fix is to either make sure that video is the value you need or to access the correct property. There is not much more we can say about it without having more context.

– Felix Kling
Mar 27 at 23:07













1 Answer
1






active

oldest

votes


















1















I actually fixed it.



In my case, the problem didn't have anything to do with toFixed().



My problem was due to mixing JQuery and Vanilla Javascript.



Like this,



let video = $(".video");

video.on("timeupdate", function()
let colorPos = video.currentTime / video.duration;
color.style.width = colorPos * 100 + "%";
if (video.ended)
btn.className = "replay";

);


Solution



let video = document.querySelector(".video");

video.addEventListener("timeupdate", function()
let colorPos = video.currentTime / video.duration;
color.style.width = colorPos * 100 + "%";
if (video.ended)
btn.className = "replay";

);





share|improve this answer




















  • 2





    As I said, the error means that the value of getTimePaused is undefined, which means that video doesn't have the property currentTime. jQuery objects don't have that property. Another solution would have been to use video[0].currentTime. And that's why it was important to tell us what the value of video is. If we had known, we could have immediately pointed out what was wrong.

    – Felix Kling
    Mar 27 at 23:41












  • can you please update your question with the code that you decided to show here, too?

    – Mike 'Pomax' Kamermans
    Mar 28 at 0:04










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387791%2fcannot-read-property-tofixed-of-undefined-uncaught-typeerror%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1















I actually fixed it.



In my case, the problem didn't have anything to do with toFixed().



My problem was due to mixing JQuery and Vanilla Javascript.



Like this,



let video = $(".video");

video.on("timeupdate", function()
let colorPos = video.currentTime / video.duration;
color.style.width = colorPos * 100 + "%";
if (video.ended)
btn.className = "replay";

);


Solution



let video = document.querySelector(".video");

video.addEventListener("timeupdate", function()
let colorPos = video.currentTime / video.duration;
color.style.width = colorPos * 100 + "%";
if (video.ended)
btn.className = "replay";

);





share|improve this answer




















  • 2





    As I said, the error means that the value of getTimePaused is undefined, which means that video doesn't have the property currentTime. jQuery objects don't have that property. Another solution would have been to use video[0].currentTime. And that's why it was important to tell us what the value of video is. If we had known, we could have immediately pointed out what was wrong.

    – Felix Kling
    Mar 27 at 23:41












  • can you please update your question with the code that you decided to show here, too?

    – Mike 'Pomax' Kamermans
    Mar 28 at 0:04















1















I actually fixed it.



In my case, the problem didn't have anything to do with toFixed().



My problem was due to mixing JQuery and Vanilla Javascript.



Like this,



let video = $(".video");

video.on("timeupdate", function()
let colorPos = video.currentTime / video.duration;
color.style.width = colorPos * 100 + "%";
if (video.ended)
btn.className = "replay";

);


Solution



let video = document.querySelector(".video");

video.addEventListener("timeupdate", function()
let colorPos = video.currentTime / video.duration;
color.style.width = colorPos * 100 + "%";
if (video.ended)
btn.className = "replay";

);





share|improve this answer




















  • 2





    As I said, the error means that the value of getTimePaused is undefined, which means that video doesn't have the property currentTime. jQuery objects don't have that property. Another solution would have been to use video[0].currentTime. And that's why it was important to tell us what the value of video is. If we had known, we could have immediately pointed out what was wrong.

    – Felix Kling
    Mar 27 at 23:41












  • can you please update your question with the code that you decided to show here, too?

    – Mike 'Pomax' Kamermans
    Mar 28 at 0:04













1














1










1









I actually fixed it.



In my case, the problem didn't have anything to do with toFixed().



My problem was due to mixing JQuery and Vanilla Javascript.



Like this,



let video = $(".video");

video.on("timeupdate", function()
let colorPos = video.currentTime / video.duration;
color.style.width = colorPos * 100 + "%";
if (video.ended)
btn.className = "replay";

);


Solution



let video = document.querySelector(".video");

video.addEventListener("timeupdate", function()
let colorPos = video.currentTime / video.duration;
color.style.width = colorPos * 100 + "%";
if (video.ended)
btn.className = "replay";

);





share|improve this answer













I actually fixed it.



In my case, the problem didn't have anything to do with toFixed().



My problem was due to mixing JQuery and Vanilla Javascript.



Like this,



let video = $(".video");

video.on("timeupdate", function()
let colorPos = video.currentTime / video.duration;
color.style.width = colorPos * 100 + "%";
if (video.ended)
btn.className = "replay";

);


Solution



let video = document.querySelector(".video");

video.addEventListener("timeupdate", function()
let colorPos = video.currentTime / video.duration;
color.style.width = colorPos * 100 + "%";
if (video.ended)
btn.className = "replay";

);






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 27 at 23:11









Cazador ShawCazador Shaw

1379 bronze badges




1379 bronze badges










  • 2





    As I said, the error means that the value of getTimePaused is undefined, which means that video doesn't have the property currentTime. jQuery objects don't have that property. Another solution would have been to use video[0].currentTime. And that's why it was important to tell us what the value of video is. If we had known, we could have immediately pointed out what was wrong.

    – Felix Kling
    Mar 27 at 23:41












  • can you please update your question with the code that you decided to show here, too?

    – Mike 'Pomax' Kamermans
    Mar 28 at 0:04












  • 2





    As I said, the error means that the value of getTimePaused is undefined, which means that video doesn't have the property currentTime. jQuery objects don't have that property. Another solution would have been to use video[0].currentTime. And that's why it was important to tell us what the value of video is. If we had known, we could have immediately pointed out what was wrong.

    – Felix Kling
    Mar 27 at 23:41












  • can you please update your question with the code that you decided to show here, too?

    – Mike 'Pomax' Kamermans
    Mar 28 at 0:04







2




2





As I said, the error means that the value of getTimePaused is undefined, which means that video doesn't have the property currentTime. jQuery objects don't have that property. Another solution would have been to use video[0].currentTime. And that's why it was important to tell us what the value of video is. If we had known, we could have immediately pointed out what was wrong.

– Felix Kling
Mar 27 at 23:41






As I said, the error means that the value of getTimePaused is undefined, which means that video doesn't have the property currentTime. jQuery objects don't have that property. Another solution would have been to use video[0].currentTime. And that's why it was important to tell us what the value of video is. If we had known, we could have immediately pointed out what was wrong.

– Felix Kling
Mar 27 at 23:41














can you please update your question with the code that you decided to show here, too?

– Mike 'Pomax' Kamermans
Mar 28 at 0:04





can you please update your question with the code that you decided to show here, too?

– Mike 'Pomax' Kamermans
Mar 28 at 0:04








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387791%2fcannot-read-property-tofixed-of-undefined-uncaught-typeerror%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript