JavaScript code not running in HTML5 document

Gio31290 picture Gio31290 · Sep 7, 2014 · Viewed 11.9k times · Source

I'm beginning HTML5 development, and I'm already in trouble with javascript in HTML code:

<script>

// javascript code

</script>

If i write my code in HTML only, there's no problem, As soon as I add javascript code, only HTML works but javascript doesn't seem to exist while debugging.

May I link some libraries for JS language? I tryied to create a separate .js file, same problem.

PS. I'm working with Komodo Edit

Thanks for possible solutions.

Answer

spender picture spender · Sep 7, 2014

Take a careful look at this minimal example and compare with your own code...

<!DOCTYPE html>
<html>
    <head>
        <title>test</title>
        <script type="text/javascript">
            alert("this works");
        </script>
    </head>
    <body>
    </body>
</html>