Javascript examples for DOM HTML Element:Meta
You can create a <meta> element by using the document.createElement() method:
<!DOCTYPE html> <html> <head> </head>/*w w w . j a v a 2 s. co m*/ <body> <button onclick="myFunction()">create a META element</button> <p id="demo"></p> <script> function myFunction() { var x = document.createElement("META"); x.setAttribute("name", "description"); x.setAttribute("content", "tutorials"); document.head.appendChild(x); document.getElementById("demo").innerHTML = "created a META element in the HEAD section."; } </script> </body> </html>