Not recognizing js file when it is in 2 folders

0

Well my html is not recognizing the js file when I put it in 2 folders eg when I put

<script type="text/javascript" src="assets/js/scripts.js"></script>

It does not work even if the file is there, then I just moved the file to js / scripts.js and it worked normally, someone can tell me what's causing it.

link

PS: There asssets, with 3 "S", but I put it wrong just in time to get the same print.

    
asked by anonymous 30.01.2015 / 00:19

1 answer

3

Put the <script type="text/javascript" src="assets/js/scripts.js"></script> tag before closing the body </body> instead of outside it before </html> .

Exemplifying:

...
    <script type="text/javascript" src="assets/js/scripts.js"></script>
    <script>
        hideElement...
    </script>
</body>
</html>

OBS: It is no longer necessary to specify the type in the LINK and SCRIPT tags since you are using HTML5.

Getting:

<script src="assets/js/scripts.js"></script>
  

The type attribute gives the language of the script or format of the data. If the attribute is present, its value must be a valid MIME type. The charset parameter must not be specified. The default, which is used if the attribute is absent, is "text / javascript".

Documentation: Scripting - W3 Recommendation

OBS: Also check your .htaccess . It may be blocking directory access.

    
30.01.2015 / 00:31