DEV Community

rawkiesthinker
rawkiesthinker

Posted on

Codesandbox has a bug with my JS(Function does not exist)

Just recently a friend asked for some help on a problem, right in the middle of work, me being the nice guy, I put everything down and worked on it.

All they sent was an image, and I had to decipher what they had asked.

Now comes the tricky part setting up my environment for their problem, the fastest way to get to the solution, I still have work that needs to be done.

Always saw this codesandbox and yet I never used it figured should be the best time to play with it, I have an already fully set up environment, and can share the code with them as quickly as possible without stressing about how are they going to transfer my code from WhatsApp to their editor.

So I create a sandbox

and pluck in code will learn from day one some dirty HTML, that calls a function onClick

MY HTML

and then some very illogical js
MY JS

Added a jquery dependency.

Jquery Depedency

the reason why I did not want to code on my machine, had no time to download a dependency,

and hey guess what codesandbox sends me an error telling me the function changeColour does not exist.

Having no time to debug why codesandbox is being a baby I decided to move onto my trusty vscode(I can not belive I am saying this)

And plucked that in there(spent a whole 5 mins getting the jquery cdn) ran my code, and it worked. thank goodness for a second there i thought everything i knew was wrong

Then I woke up and realized codesandbox should not have bugged out on me like that, honestly, that would have saved me an extra 10 minutes, my friend would have been helped and i would have gotten back to work, in record time.

And I would have practiced some real good source control practices

Well I really would like to start using codesandbox, and need some help on this bug, will delay this post a day to see if I can not find any solutions to this bug, and the help tag is allowed.

But I call upon all devs can you please help me with this, here is the code already sandboxed and ready to be fixed

thank you in advance.

Top comments (0)