Event Onsearch
# onsearch Event
[ Event Object](#)
## Example
Execute JavaScript when a search is submitted:
[Try it Β»](#)
* * *
## Definition and Usage
The onsearch event occurs when the user presses the "ENTER" key or clicks the "x (search)" button on an `` element with `type="search"`.
* * *
## Browser Support
The numbers in the table specify the first browser version that fully supports the event.
| Event | | | | | |
| --- | --- | --- | --- | --- | --- |
| onsearch | Yes | Not supported | Not supported | Yes | 15.0 |
* * *
## Syntax
In HTML:
(#)
In JavaScript:
_object_.onsearch=function(){_myScript_};(#)
In JavaScript, using the addEventListener() method:
_object_.addEventListener("search", _myScript_);(#)
**Note:** Internet Explorer 8 or earlier does not support the [addEventListener()](#) method.
* * *
## Technical Details
| Bubbles: | Yes |
| --- |
| Cancelable: | No |
| Event type: | Event |
| Supported HTML tags: | |
* * Event Object](#)
YouTip