 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Input Search size property
The HTML DOM Input Search size property is used for setting or returning the input search field size attribute value. It is used for defining the search field width in terms of characters. The default width is of 20 characters.
Syntax
Following is the syntax for −
Setting the Search size property −
searchObject.size = number
Here, number represents the search field width in characters. The default width is 20 characters.
Example
Let us look at an example for the Input search size property −
<!DOCTYPE html> <html> <body> <h1>Input search size property</h1> <form> FRUITS: <input type="search" id="SEARCH1" name="fruits"> </form> <p>Change the Search field width by clicking the below button</p> <button onclick="changeSize()">CHANGE</button> <p id="Sample"> <script>    function changeSize() {       document.getElementById("SEARCH1").size+=20;       var s=document.getElementById("SEARCH1").size;       document.getElementById("Sample").innerHTML="The search field width is now "+ s;    } </script> </body> </html> Output
This will produce the following output −

On clicking the CHANGE button −

Advertisements
 