So i want to connect my array from javaScript to my html, some one can explain how can i do that? i am only able to find when the javascript is in the same html.
html file: rest of the code in html ...
<label for="eye">Which eye color does the character have?</label>
<select name="eye" id="eye">
<option value="blue">Blue</option>
<option value="brown">Brown</option>
<option value="green">Green</option>
</select>
<script>
src = "js/eindopdracht.js"
</script>
js file:
var eyeColors = ["blue", "brown","green"];
the correct tag for you to use is is:
<script src="js/eindopdracht.js"></script>
this is how to include an external javascript file.
If you want to add javascript code inline then you would do:
<script>
console.log("this is inline javascript");
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.