Really basic javascript question:
Can I save code within <script>...</script> in a different file and include it?
Will it work exactly the same?
Can I include it in the exact same place as the <script>...</script>?
Really basic javascript question:
Can I save code within <script>...</script> in a different file and include it?
Will it work exactly the same?
Can I include it in the exact same place as the <script>...</script>?
Yes. Put a src attribute (where the value is the URL of the script) on the <script> element (then leave the element content empty).
Save your Code in a file, name it xyz.js and include it:
<script src="path/xyz.js"></script>