Questions tagged [script-tag]

The

The <script> tag is an HTML element used to embed or include an executable script within an (x)HTML document/web-page.
This is almost always client-side javascript.

For example:

<!-- HTML4 and (x)HTML include -->
<script type="text/javascript" src="javascript.js">

<!-- HTML5  include -->
<script src="javascript.js"></script>

<!-- Embed -->
<script type="text/javascript">
    //-- Any valid javascript code can go here.
    alert ("Hello world!");
</script>


Resources:

320 questions
144
votes
16 answers

How to tell if a Within that embed.js file, how can I get the value of data-id attribute? I'm trying to keep the embed.js file as light as possible, so…

Shpigford
  • 24,748
  • 58
  • 163
  • 252
42
votes
1 answer

"Unterminated template literal" syntax error when literal contains script tag

I'm using ES6 template literals to construct some HTML in strings, and so far it has been working fine. However, as soon as I try to put the literal text in my string the browser throws up and throws the syntax error: SyntaxError:…
Michael
  • 9,060
  • 14
  • 61
  • 123
39
votes
7 answers

Get content inside script as text

I would like to print the content of a script tag is that possible with jquery? index.html Code alert($("script")[0].???); result function…
DVD
  • 1,744
  • 3
  • 17
  • 34
29
votes
2 answers

Can I have