Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript create form element

<script>
            var down = document.getElementById("GFG_DOWN");
            function GFG_Fun() {
               
                // Create a form dynamically
                var form = document.createElement("form");
                form.setAttribute("method", "post");
                form.setAttribute("action", "submit.php");
 
                // Create an input element for emailID
                var ID = document.createElement("input");
                ID.setAttribute("type", "text");
                ID.setAttribute("name", "emailID");
                ID.setAttribute("placeholder", "E-Mail ID");
 
                // Create an input element for password
                var PWD = document.createElement("input");
                PWD.setAttribute("type", "password");
                PWD.setAttribute("name", "password");
                PWD.setAttribute("placeholder", "Password");
 
                // Create a submit button
                var s = document.createElement("input");
                s.setAttribute("type", "submit");
                s.setAttribute("value", "Submit");
 
                // Append the email_ID input to the form
                form.append(ID);
               
                // Append the password to the form
                form.append(PWD);
               
                // Append the button to the form
                form.append(s);
 
                document.getElementsByTagName("body")[0]
               .appendChild(form);
            }
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript while loop 
Javascript :: js clear map 
Javascript :: vuejs reset component 
Javascript :: array any 
Javascript :: reactjs date display 
Javascript :: how to sum variables to an array in javascript 
Javascript :: how to useeffect for unmount 
Javascript :: js math random 
Javascript :: javascript spread array without duplicates 
Javascript :: saving react code messing up in vsc 
Javascript :: get selected option text jquery 
Javascript :: sanitize data within an Express application 
Javascript :: null value check in react js 
Javascript :: history javascript 
Javascript :: Round Decimals to a Certain Number of Decimal Places 
Javascript :: multiple image upload in react js 
Javascript :: hosting react with pm2 
Javascript :: convert nested json to csv python 
Javascript :: mongoose create 
Javascript :: js convert number array to string array 
Javascript :: variable javascript 
Javascript :: check web3 metamask disconnect 
Javascript :: momentjs get calendar week 
Javascript :: javascript select option based on text 
Javascript :: performing query with sequelize includes 
Javascript :: route not getting refresh with different id in angular 
Javascript :: react render for loop 
Javascript :: Adding User And Hashed Password In ExpressJS 
Javascript :: form validation for email in js 
Javascript :: while loop in javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =