In my html document (which is in the xampp/htdocs
directory), I'm using an external .js file. The .js file is in the same directory as my html file. I'm simply trying to use document.write()
function and it's not printing anything.
I don't understand what I'm doing wrong. Whats the issue?
HTML file
<!DOCTYPE html>
<html>
<head>
<?php include 'include/head_elements.html'?>
<script type="text/javascript" src="register.js"></script>
</head>
<body>
<h1>Company Account creation</h1>
<div id="registration_menu">
<!--Elements are added and removed dynamically using JS-->
</div>
<script>
hello();
load_element_group("email_verification");
</script>
</body>
</html>
JS file
function hello(){
document.write("Hello world")
}
`, and below it says "Hello World". 1. check your browser console for error messages 2. press Ctrl+U to look at the source HTML and click the underlined script src _register.js_. Do you see the script?
– Apr 24 '19 at 20:25` for me
– Andrew Kor Apr 24 '19 at 20:26