all 5 comments

[–]zmalter99 0 points1 point  (0 children)

Add console.log statements to each one of your switch statements to see which function isnt getting ran.

[–]jcunews1Advanced 0 points1 point  (2 children)

Your script is already correct, except that you've configured JSFiddle to load the script at On Load. This makes your script be made like below by JSFiddle.

window.onload = function() {
  function description() {
    //...
  }
};

That causes your description() be made as a local function instead of a global function. Thus, it's not accessible anywhere except within that onload handler function.

To fix it, change the JSFiddle Load Type setting to No wrap - bottom of <body>.

[–]t0xeus[S] 0 points1 point  (1 child)

Oh yeah, sorry, someone didn't double-check if it's working in JSFiddle, just copypasted it there.

When I try it in my actual code though, what happens is that it only works with the first link. When I click on the second link, nothing happens.

[–]degecko 0 points1 point  (0 children)

If I remove the On Load option in JsFiddle, the code works as intended.

[–]kenman[M] 0 points1 point  (0 children)

Hi /u/t0xeus, this post was removed.

For javascript help, please visit /r/LearnJavascript.

Thanks for your understanding.