HTML onscroll Attribute

❮ HTML Attributes


<div id="myDIV" onscroll="myFunction()">


The onscroll attribute specifies the script to be run when an element's scrollbar is being scrolled.

Standard Syntax

<element onscroll="script">

Browser Support


Applies to:

The onscroll attribute can be used on the following element:

Element Attribute
All HTML elements. onscroll

Attribute Values

Value Description
script Specifies the script to be run on onscroll.
❮ HTML Attributes