onsearchEvent

事件对象参考手册Event Object

Example

Execute JavaScript when submitting a search:

<input type="search" onsearch="myFunction()">

Try it Yourself »


Definition and Usage

The onsearch event fires when the user presses the "ENTER" (Return) key or clicks the "x (search)" button in an <input> 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:

<element onsearch="myScript">Try it Yourself

In JavaScript:

object.onsearch=function(){myScript};Try it Yourself

In JavaScript, using the addEventListener() method:

object.addEventListener("search", myScript);Try it Yourself

Note:Internet Explorer 8 and earlier IE versions do not support theaddEventListener()method.


Technical Details

Does it bubble: Yes
Is it cancelable: No
Event type: Event
Supported HTML tags: <input type="search">


事件对象参考手册Event Object

Other extensions