Ask coding questions

← Back to all posts
WilliamXing (52)

Why is it that everytime I copy paste code from codepen, it never works?

Answered by OldWizard209 (1617) [earned 5 cycles]
View Answer
OldWizard209 (1617)

It may because there are some pre-installed frameworks in codepen that are being used. Also, make sure to put all the code in the HTML boilerplate on replit.

btfuss (178)

Before importing, if the HTML, CSS, or Javascript has a () next to it then click the three dot thingy and click View Compiled (Html, css, or js). Then you can import the code in the 3rd step

Second, if in the JS it has a $ in the code, in the head tag put
<script src="jquery-3.5.1.min.js"></script> to import jquery.

So, third it doesn't include the first couple of tags:

<link rel="stylesheet" href="style.css">
<title>(Site Name)</title>

<script src="script.js"></script>

Put your CSS in the style.css file, and your javascript in script.js, html in index.html and boom everything works!