We can create a <fieldset> element via the document.createElement()
method:
var x = document.createElement("FIELDSET");
Click the button to create a FIELDSET element with some text.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*from www. j a v a2s . c om*/ var x = document.createElement("FIELDSET"); var t = document.createTextNode("Insert content here..."); x.appendChild(t); document.body.appendChild(x); } </script> </body> </html>