I have write a script with script tag within head and some other script in another script tag within body tag. I have defined a variable as a global variable in a script tag which has placed inside the head. and I need to update the value of that global variable in both script tag. is it possible or not? it shows some error on this
Why are you using multiple
Initially I have write all of my script within body tag. then only I realize that, some script needs to be written within head tag. So I wrote that particular script within head tag
script tags, I suggest using only one.
Not sure why (sometimes there a legit reasons but rare), but maybe if you shared the file contents, we might be able to suggest a way of putting it in a single script tag or like @ArielLeslie suggested, a single external JS file that is linked to the page .