Grow your CSS skills. Land your dream job.

CodePen – JS not working in full?

  • # February 26, 2013 at 1:11 pm

    [http://codepen.io/seanjacob/full/reHIw](http://codepen.io/seanjacob/full/reHIw “”)

    My function is not defined in full mode.

    I can add the JS to the HTML box and get it working though.

    # February 26, 2013 at 2:13 pm

    Well something happens in Pen mode.

    Could this be a document.ready issue?

    # February 26, 2013 at 4:47 pm

    Interesting, apparently codepen wraps the JavaScript in a self-invoking function in full mode, so your function doesn’t get added to global scope.

    # February 27, 2013 at 7:37 am

    Try `window.tab = function(x) { … }` instead of `function tab(x) { … }`

    # February 27, 2013 at 7:42 am

    Thank you this works but `function tab(x)` should work too. I have now submitted the bug anyways.

    # February 27, 2013 at 7:47 am

    Already told you why `function tab(x) { … }` didn’t work. You’ve submitted it as bug to codepen? I’m curious if they are going to fix that because I think if you had the click listeners in JavaScript instead of inlined with the html (as you should have) it would have worked. Keeping scripting and markup separate. Nevertheless it’s a bug.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".