Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML onfocus Event Attribute

HTML onfocus Event Attribute

HTML Event Attributes HTML Event Attributes

Example

Run a script when the input field gains focus:

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the onfocus event attribute


Definition and Usage

The onfocus attribute is triggered when an element gains focus

Onfocus is usually used for ,