HTML DOM Form Object Last Updated : 28 Feb, 2023 Comments Improve Suggest changes Like Article Like Report The Form Object in HTML DOM is used to represent the HTML < form > element. This tag is used to set or get the properties of < form > element. This element can be accessed by using getElementById() method. Syntax: document.getElementById("Form_ID"); Note: This Form_ID is assigned to HTML < form > element. Example 1: Returning "form id" using document.getElementById("myForm").id;. html <h1 style="color:green;"> GeeksforGeeks </h1> <h2>DOM Form Object</h2> <form id="myForm" method="GET" target="_blank" action="/action_page.php"> First name: <br> <input type="text" name="fname" placeholder="FName"> <br> <br> Last name: <br> <input type="text" name="lname" placeholder="LName"> <br> <br> </form> <button onclick="myGeeks()"> Submit </button> <p id="Geek_p" style="color:green; font-size:30px;"> </p> <script> function myGeeks() { // Accessing form element. var txt = document.getElementById( "myForm").id; document.getElementById( "Geek_p").innerHTML = txt; } </script> Output HTML DOM Form Object Example 2: Returning the value of the target attribute in the form using document.getElementById("Form_ID").target;. html <h1 style="color:green;"> GeeksforGeeks </h1> <h2>DOM Form Object</h2> <form id="myForm" method="GET" target="_blank" action="/action_page.php"> First name: <br> <input type="text" name="fname" placeholder="FName"> <br> <br> Last name: <br> <input type="text" name="lname" placeholder="LName"> <br> <br> </form> <button onclick="myGeeks()"> Submit </button> <p id="Geek_p" style="color:green; font-size:30px;"> </p> <script> function myGeeks() { // Accessing form. var txt = document.getElementById( "myForm").target; document.getElementById( "Geek_p").innerHTML = txt; } </script> Output HTML DOM Form Object Example 3: Returning the number of elements in the form using document.getElementById("Form_ID").length;. html <h1 style="color:green;"> GeeksforGeeks </h1> <h2>DOM Form Object</h2> <form id="myForm" method="GET" target="_blank" action="/action_page.php"> First name: <br> <input type="text" name="fname" placeholder="FName"> <br> <br> Last name: <br> <input type="text" name="lname" placeholder="LName"> <br> <br> </form> <button onclick="myGeeks()"> Submit </button> <p id="Geek_p" style="color:green; font-size:30px;"> </p> <script> function myGeeks() { //Accessing form element. var txt = document.getElementById( "myForm").length; document.getElementById( "Geek_p").innerHTML = txt; } </script> Output HTML DOM Form Object Supported Browsers: Google ChromeMozilla FirefoxEdge 12 and aboveSafariOpera Comment More infoAdvertise with us P PranchalKatiyar Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML DOM MouseEvent screenX Property The MouseEvent.screenX property is used to get the horizontal coordinate (in pixels) of the mouse pointer relative to the screen, not the viewport when a mouse event occurs. This value represents the distance from the left edge of the user's screen to the mouse pointer's position.Syntax :event.scree 1 min read HTML | DOM Style fontSizeAdjust Property The fontSizeAdjust property controls better the font size if the first choice of font is not available. It sets or returns the font aspect value of the text. Aspect value is the size difference between the lowercase letter "x" and the uppercase letter "X". Syntax: To set the fontSizeAdjust propertyo 2 min read HTML DOM compareDocumentPosition() Method The DOM compareDocumentPosition() method is used to compare two nodes and it returns an integer describing where they are positioned in the document. Syntax: node1.compareDocumentPosition(node2) Return Value : This return an integer value and their meaning as follows : 1: This means that the two nod 3 min read HTML | DOM touchstart Event The touchstart event is used to execute a script whenever the user touches an HTML element. On touching a particular element, if the touchstart event is associated with it, it can be used to trigger a javascript function. Note: The touchstart event works only on touch screen devices.Supported Tags A 1 min read HTML DOM Image Object The HTML DOM Image object represents an HTML <img> element, allowing for dynamic manipulation of images in the document. This object provides various properties and methods to change image attributes like src, alt, width, height, and more, as well as handling image events such as onload and on 2 min read HTML DOM TransitionEvent propertyName Property The TransitionEvent propertyName property is a read-only property and used for returning the name of the CSS property associated with a transition when a transitionevent occurs. Syntax :event.propertyNameReturn Value: It returns a string representing the transition's name. Example: In this example, 1 min read HTML | DOM Style outlineColor Property The DOM Style outlineColor Property is used to sets or returns the color of the outline around an Element. Syntax: It is used to Return the outlineColor propertyobject.style.outlineColor it is used to Set the outlineColor propertyobject.style.outlineColor = "color|invert|initial|inherit" Property Va 2 min read HTML | DOM touchmove Event The touchmove event is used to execute a script when the user moves the finger across the screen. It works only on touch screen devices and triggers once for every movement and continues to trigger until the finger is released.Supported Tags All HTML elements supported by this event. Syntax: object. 1 min read HTML | DOM Style isolation Property The DOM Style isolation Property defines whether an element must necessarily create a new stacking context. Syntax: Return isolation syntax:object.style.isolationSet isolation syntax:object.style.isolation = "auto|isolate|initial|inherit" Properties: auto: It is the default property value. Using thi 3 min read HTML | DOM TouchEvent metaKey Property The TouchEvent metaKey property is a read-only property and used for returning a Boolean value which indicates whether or not the "meta" key was pressed when a touch event triggered. It mostly returns false because generally, touch devices do not have a meta key. Syntax: event.metaKey Return Value: 2 min read Like