Home › Forums › JavaScript › Learning basic › Re: Learning basic
March 30, 2013 at 4:20 pm
#130232
hotpink
Member
The main problem is that the variable: sText is defined outside the “scope” of where you are calling it.
When you define a variable inside of a function, it is available only within that function.
Here is a fork of your codepen that demonstrates the concept
http://codepen.io/jessecfisher/pen/DFzmB
If you don’t understand the code changes I’ve made, ask more questions :)
## Codepen tips
Here is a simplified version of your code that takes advantage of Codepen features.
You can see that the
jQuery can be included by clicking the gear image on the top right of the JS box.