Latest web development tutorials

HTML DOM Input Search size property

Input Search Object Reference Input Search Object

Examples

Modify the length of the search field:

document.getElementById ( "mySearch") size = "50".;

try it"

Definition and Usage

size property is used to set or return the value of the search field size property.

size attribute describes the search field length (number of characters).

The default value is 20.

Tip: If you need to set the search field allows you to enter the maximum number of characters, use the maxLength property.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the size attribute.


grammar

Returns size properties:

searchObject .size

Set size properties:

searchObject .size = number

Property Value

value description
number It describes a number of search fields length, character. The default value is 20.

technical details

return value: Number that is the length of the search field, characters.


More examples

Examples

Display search field length (number of characters):

var x = document.getElementById ( "mySearch") size.;
x The output is:
35

try it"


Related Pages

HTML Reference Manual: HTML <the INPUT> size attributes


Input Search Object Reference Input Search Object