Click here to Skip to main content
14,661,421 members
Home » Discussions » JavaScript
   

JavaScript

 
GeneralRe: Javascript function error. Pin
and180y10-Jun-20 1:55
Memberand180y10-Jun-20 1:55 
GeneralRe: Javascript function error. Pin
and180y10-Jun-20 23:06
Memberand180y10-Jun-20 23:06 
GeneralRe: Javascript function error. Pin
Richard Deeming10-Jun-20 23:30
mveRichard Deeming10-Jun-20 23:30 
GeneralRe: Javascript function error. Pin
and180y10-Jun-20 23:45
Memberand180y10-Jun-20 23:45 
JokeRe: Javascript function error. Pin
DerekT-P11-Jun-20 2:26
professionalDerekT-P11-Jun-20 2:26 
AnswerRe: Javascript function error. Pin
jkirkerx12-Jun-20 7:57
professionaljkirkerx12-Jun-20 7:57 
GeneralRe: Javascript function error. Pin
and180y12-Jun-20 8:33
Memberand180y12-Jun-20 8:33 
GeneralRe: Javascript function error. Pin
jkirkerx12-Jun-20 8:47
professionaljkirkerx12-Jun-20 8:47 
GeneralRe: Javascript function error. Pin
and180y12-Jun-20 10:48
Memberand180y12-Jun-20 10:48 
GeneralRe: Javascript function error. Pin
jkirkerx12-Jun-20 11:11
professionaljkirkerx12-Jun-20 11:11 
GeneralRe: Javascript function error. Pin
jkirkerx12-Jun-20 10:17
professionaljkirkerx12-Jun-20 10:17 
That's JQuery like syntax.
IMO, Don't waste your time learning JQuery, I've been there and done that already.
JQuery is obsolete now, because modern browsers support modern JavaScript.
JQuery adds 3 Lbs to your first page download, and is very heavy in weight, in exchange to write shorthand JavaScript.

The reason your not absorbing or moving faster with knowledge is because your looking at shorthand JavaScript/JQuery examples, and trying to understand and copy them. These are very advanced writing skills. You should start with entry level skill writing, and when you get that down, move to shorthand.

I would of wrote it like this, for a beginner example.
ES6

Use HTML to bind the event to the button, and run calcTime().
Use camel case to label things eg. calcTime vs CalcTime vs calc-time
let has replaced var
use const instead of var or let to when something that is constant.
Try not to make a lot of const, see how I did it in one line

ES6 Example
<button type="button" onBlur="calcTime()">Calculate</button>

function calcTime() {

  // Make references to input elements
  const time = document.getElementById("currentCharge"),
    current = document.getElementById("timeAllowed"),
    breakEven = document.getElementById("breakEven");

  // Get the element values, convert to number/float
  // By default, values are strings, and don't do math well.
  let t = parseFloat(time.value);
  let c = parseFloat(current.value);

  // Perform the equation
  let bE = t * c;

  // Output the equation
  breakEven.innerHTML = bE.toString();

}

JavaScript comes in many flavors now.
I think you want ECMAScript 6, ES6, ECMAScript 2015
From there, you can branch out to TypeScript, Node, etc.
I don't know of a good learning course, but you need to stick to one version in order to learn.
And when searching for help on the internet, find examples in ES6; learn to identity ES6 examples, and then code and test.
If it ain't broke don't fix it
Discover my world at jkirkerx.com

GeneralRe: Javascript function error. Pin
and180y13-Jun-20 5:57
Memberand180y13-Jun-20 5:57 
GeneralRe: Javascript function error. Pin
Richard MacCutchan13-Jun-20 6:31
mveRichard MacCutchan13-Jun-20 6:31 
GeneralRe: Javascript function error. Pin
and180y13-Jun-20 11:48
Memberand180y13-Jun-20 11:48 
GeneralRe: Javascript function error. Pin
jkirkerx13-Jun-20 7:36
professionaljkirkerx13-Jun-20 7:36 
GeneralRe: Javascript function error. Pin
and180y13-Jun-20 11:47
Memberand180y13-Jun-20 11:47 
QuestionJavaScript slide show works bad on the first page load Pin
Hypnonis8-Jun-20 20:03
MemberHypnonis8-Jun-20 20:03 
AnswerRe: JavaScript slide show works bad on the first page load Pin
Richard Deeming8-Jun-20 22:30
mveRichard Deeming8-Jun-20 22:30 
GeneralRe: JavaScript slide show works bad on the first page load Pin
Hypnonis9-Jun-20 6:33
MemberHypnonis9-Jun-20 6:33 
QuestionJSON object not showing values.. Can someone help Pin
Member 35640766-Jun-20 4:33
MemberMember 35640766-Jun-20 4:33 
GeneralRe: JSON object not showing values.. Can someone help Pin
Richard MacCutchan7-Jun-20 0:50
mveRichard MacCutchan7-Jun-20 0:50 
QuestionPyramid array Pin
Girardi.E30-May-20 0:48
MemberGirardi.E30-May-20 0:48 
AnswerRe: Pyramid array Pin
Richard MacCutchan30-May-20 1:15
mveRichard MacCutchan30-May-20 1:15 
AnswerRe: Pyramid array Pin
DerekT-P30-May-20 2:30
professionalDerekT-P30-May-20 2:30 
Questionidentify each node with its Id Pin
vikas@prajaktasoftware.com19-May-20 8:57
Membervikas@prajaktasoftware.com19-May-20 8:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.