I would like to load a script that contains the content of a div on my html page. I know this is possible, but I am struggling to understand how to do it. Here is my html:
<html>
<body>
<script src="script.js"> </script>
<div id="helloWorld"> </div>
</body>
</html>
What would script.js have to be for the html page to display something? I was thinking something like this (I know it's incorrect, I'm a beginner at javascript.
function showText()
{
$("#helloWorld").html("<p> Hello World! </p>")
$("#helloWorld").show();
}
showText()
Can someone tell me whether or not I'm on the right track, and how I could fix this? Thanks, Sam