My js external file is not working in a head tag, however, it's working on calling at the end of code.
<title> java Script</title>
<link rel="stylesheet" href="style.css">
Before the browser can render a page it has to build the DOM tree by parsing the HTML markup. During this process, whenever the parser encounters a script it has to stop and execute it before it can continue parsing the HTML. If your script tries to access an element in the
<body> of your file, it will fail because that part of the DOM is not loaded as yet.
Place your script before the end