HTML DOM Input Search Object Last Updated : 02 Jan, 2024 Comments Improve Suggest changes Like Article Like Report The Input Search object is used for representing an HTML <input> element of the type="search". The Input Search Object is new in HTML5. Syntax: For creating a <input> element with the type ="search":let input_field = document.createElement("input");input_field.setAttribute("type", "search");Syntax for accessing a <input> element with the type ="search":let search_element = document.getElementById("search_object");Property Values: Property Value Description autocomplete Set or return the value of the autocomplete attribute of a search field. autofocus Set or return whether a search field should automatically get focus when the page loads. defaultValue Set or return the default value of a search field. disabled Set or return whether a search field is disabled, or not. form Returns a reference to the form that contains the search field. list Returns a reference to the datalist that contains the search field. name Set or return the value of the name attribute of a search field. readOnly Set or return whether the search field is read-only, or not. required Set or return whether the search field must be filled out before submitting a form. step Set or return the value of the step attribute of the search field. type Returns the type of form element of the search field. value Set or return the value of the value attribute of a search field. Methods: Method Name Description focus() It is used to get focus to the input search field. blur() It is used to remove focus from the search field. select() It is used to select the content of the Input search field. Example 1: Creating an <input> element with the type ="search". html <!DOCTYPE html> <html> <head> <title>HTML DOM Input Search Object</title> </head> <body style="text-align: center;"> <h1>GeeksforGeeks</h1> <h2>HTML DOM Input Search Object</h2> <button onclick="myGeeks()"> Create Search Box </button> <br><br> <script> function myGeeks() { // Create input element with type search let input_field = document.createElement("input"); input_field.setAttribute("type", "search"); document.body.appendChild(input_field); } </script> </body> </html> Output: Example 2: Accessing an <input> element with the type ="Search". html <!DOCTYPE html> <html> <head> <title>HTML DOM Input Search Object</title> </head> <body style="text-align: center;"> <h1>GeeksforGeeks</h1> <h2>HTML DOM Input Search Object</h2> <input type="Search" id="test" placeholder="Type to search..."> <br><br> <button onclick="myGeeks()"> Get Searched Text </button> <p id="check"></p> <script> function myGeeks() { // Accessing value of input element // type="search" let input_search = document.getElementById("test").value; document.getElementById("check").innerHTML = "Searched Text: " + input_search; } </script> </body> </html> Output: Supported Browsers: Opera 10.6Internet Explorer 10Firefox 4Google Chrome 5Edge 12Apple Safari 5 Comment More infoAdvertise with us Next Article HTML DOM Input Search Object S Shubrodeep Banerjee Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML | DOM Form length Property The DOM Form length Property is used to return the number of input field contained in the form. Syntax: formObject.length Return Value: It returns a numeric value which represent the number of input field or elements in the Form. Example-1: Return the number of input field. html <!DOCTYPE html 2 min read HTML | DOM Form acceptCharset Property The DOM Form acceptCharset Property is used to set or return the value of the accept-charset attribute in the form Element. The accept-charset attribute is used to define the character encoding and is used for form submission. The default value of the accept-charset attribute is âUNKNOWNâ string whi 2 min read HTML | DOM KeyboardEvent metaKey Property The KeyboardEvent metaKey property in HTML DOM is a read-only property and is used to return a Boolean value which is used to check whether the META key is pressed or not. The KeyboardEvent metaKey property returns true if the META key is pressed, otherwise returns false. Syntax: event.metaKey Below 1 min read HTML DOM Select Object The Select object in HTML DOM is used to represent an HTML <select> element. It provides properties and methods to manipulate the <select> element and its associated <option> elements.Syntax:To create <select> element. document.createElement("SELECT")To access <select> 3 min read HTML | DOM TouchEvent touches Property The TouchEvent touches property in HTML DOM is used to return the array of touch object. It returns one for each finger that is currently touching to the surface. The touches property is a read only property and it returns an array of touch objects. Syntax: event.touches Return Value: It return the 1 min read HTML | DOM form method Property The DOM Form method Property is used to set or returnthe value of the method attribute in the form. The method attribute is used to specify the HTTP method used to send data while submitting the form. There are two kinds of HTTP Methods, which are GET and POST. Syntax: It is used to return the metho 3 min read HTML | DOM Form name Property The DOM Form name Property is used to set or return the value of the name attribute in a form. The name attribute is required for each input field. If the name attribute is not specified in an input field then the data of that field would not be sent at all. Syntax: It is used to return the name pro 2 min read HTML | DOM Style alignSelf Property The DOM Style alignSelf property is used to set or return the alignment for a selected item inside a flexible container. Syntax: To get the alignSelf Propertyobject.style.alignSelfTo set the alignSelf Propertyobject.style.alignSelf = "auto | stretch | center | flex-start | flex-end | baseline | init 6 min read HTML DOM Input Date Object HTML Input Date object represents an <input> element with type="date", enabling users to input dates conveniently via a built-in calendar interface on web forms. Syntax:Â For creating a <input> element with the type ="date":var gfg = document.createElement("input") gfg.setAttribute("type 3 min read HTML DOM InputEvent data Property The InputEvent data property is used to return the character that was inserted using the event. The InputEvent data property is a read-only property and it returns a string representing the character that was inserted. Syntax:event.dataReturn Value: It returns the input data from a text field. Below 1 min read Like