One small page that uses every element of this section. Turn on Show tags and point at any part of
the page: a label tells you which element draws it. Click to jump to that element's details below.
ScriptingWritten for this site
Every element of this section is in the page above. Point at one to find it, click it to read its details.
MDN The <script>HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code. The <script> element can also be used with other languages, such as WebGL's GLSL shader programming language and JSON.
MDN The <noscript>HTML element defines a section of HTML to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser.
MDN The <template>HTML element serves as a mechanism for holding HTML fragments, which can either be used later via JavaScript, generated immediately and inserted into a shadow DOM, or used as part of out-of-order patching with <template for="...">.
Live previewExample from MDN
<table id="producttable"> <thead> <tr> <th>UPC_Code</th> <th>Product_Name</th> </tr> </thead> <tbody> <!-- existing data could optionally be included here --> </tbody></table><template id="productrow"> <tr> <td class="record"></td> <td></td> </tr></template>
// Instantiate the table with the existing HTML tbody// and the row with the templateconst tbody = document.querySelector("tbody");const template = document.querySelector("#productrow");// Clone the new row and insert it into the tableconst clone = document.importNode(template.content, true);let td = clone.querySelectorAll("td");td[0].textContent = "1235646565";td[1].textContent = "Stuff";tbody.appendChild(clone);// Clone the new row and insert it into the tableconst clone2 = document.importNode(template.content, true);td = clone2.querySelectorAll("td");td[0].textContent = "0384928528";td[1].textContent = "Acme Kidney Beans 2";tbody.appendChild(clone2);
MDN The <slot>HTML element is a placeholder inside a Web Component that you can fill with your own markup when the component is used. This lets you create separate DOM trees and present them together.