Two Scripts in the HEAD tag

Asked By 0 points N/A Posted on -
qa-featured

 

Is it possible to insert two scripts in the HEAD part of HTML? I have copied and pasted a script to display time and a script to add undo and redo functionality to a TEXTAREA. But whenever I insert both scripts at the same time the time stops counting. I mean, you have to refresh the page first to refresh the time. Why is it doing so? I'm pretty sure the codes are working fine as long as they are not inserted in the HEAD part at the same time. I've already tested it.

SHARE
Answered By 0 points N/A #133398

Two Scripts in the HEAD tag

qa-featured

Hi Angela,

First to answer your question, yes you can insert different scripts to the <head> area in html.

If you were able to provide the code, we can debug it so I can see where the error is, right now let me just provide some solutions on how to fix this issue.

When you say you included it in your HEAD area, I'm assuming the script is just scattered inside the HEAD Tag.

The complete structure of your code should be as below where in your script should be inside the <script> tag.

<html>
<head>
<title>Insert Title Here</title>
 
<script type="text/javascript">
 
Insert Script Here
 
</script>
 
</head>
<body>
</body>
</html>

If you are already using the correct tags, then there is something wrong on how you inserted your script. Check if your scripts are overlapping; brackets might be missing or placed erroneously.

Try separating them into functions. This way they would not overlap.

Also check the triggers that call on your script, they may not be properly coded. So your code might be right, but the trigger effects were not coded properly.

Thanks Angela.

Related Questions