# jQuery website jQuery documentation

## Events / Browser

### scroll(Function fn) : jQuery

fn | Function | A function to bind to the scroll event on each of the matched elements.

Bind a function to the scroll event of each matched element.

#### Example

##### Before

    <p>Hello</p>

##### Code

    $("p").scroll( function() { alert("Hello"); } );

##### Result

    <p onscroll="alert('Hello');">Hello</p>

### scroll() : jQuery

Trigger the scroll event of each matched element. This causes all of the functions that have been bound to thet scroll event to be executed.

#### Example

##### Before

    <p onscroll="alert('Hello');">Hello</p>

##### Code

    $("p").scroll();

##### Result

    alert('Hello');

### onescroll(Function fn) : jQuery

fn | Function | A function to bind to the scroll event on each of the matched elements.

Bind a function to the scroll event of each matched element, which will only be executed once. Unlike a call to the normal .scroll() method, calling .onescroll() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

#### Example

##### Before

    <p onscroll="alert('Hello');">Hello</p>

##### Code

    $("p").onescroll( function() { alert("Hello"); } );

##### Result

    alert('Hello'); // Only executed for the first scroll

### unscroll(Function fn) : jQuery

fn | Function | A function to unbind from the scroll event on each of the matched elements.

Removes a bound scroll event from each of the matched elements. You must pass the identical function that was used in the original bind method.

#### Example

##### Before

    <p onscroll="myFunction">Hello</p>

##### Code

    $("p").unscroll( myFunction );

##### Result

    <p>Hello</p>

### unscroll() : jQuery

Removes all bound scroll events from each of the matched elements.

#### Example

##### Before

    <p onscroll="alert('Hello');">Hello</p>

##### Code

    $("p").unscroll();

##### Result

    <p>Hello</p>

### error(Function fn) : jQuery

fn | Function | A function to bind to the error event on each of the matched elements.

Bind a function to the error event of each matched element.

#### Example

##### Before

    <p>Hello</p>

##### Code

    $("p").error( function() { alert("Hello"); } );

##### Result

    <p onerror="alert('Hello');">Hello</p>

### error() : jQuery

Trigger the error event of each matched element. This causes all of the functions that have been bound to thet error event to be executed.

#### Example

##### Before

    <p onerror="alert('Hello');">Hello</p>

##### Code

    $("p").error();

##### Result

    alert('Hello');

### oneerror(Function fn) : jQuery

fn | Function | A function to bind to the error event on each of the matched elements.

Bind a function to the error event of each matched element, which will only be executed once. Unlike a call to the normal .error() method, calling .oneerror() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

#### Example

##### Before

    <p onerror="alert('Hello');">Hello</p>

##### Code

    $("p").oneerror( function() { alert("Hello"); } );

##### Result

    alert('Hello'); // Only executed for the first error

### unerror(Function fn) : jQuery

fn | Function | A function to unbind from the error event on each of the matched elements.

Removes a bound error event from each of the matched elements. You must pass the identical function that was used in the original bind method.

#### Example

##### Before

    <p onerror="myFunction">Hello</p>

##### Code

    $("p").unerror( myFunction );

##### Result

    <p>Hello</p>

### unerror() : jQuery

Removes all bound error events from each of the matched elements.

#### Example

##### Before

    <p onerror="alert('Hello');">Hello</p>

##### Code

    $("p").unerror();

##### Result

    <p>Hello</p>

### load(Function fn) : jQuery

fn | Function | A function to bind to the load event on each of the matched elements.

Bind a function to the load event of each matched element.

#### Example

##### Before

    <p>Hello</p>

##### Code

    $("p").load( function() { alert("Hello"); } );

##### Result

    <p onload="alert('Hello');">Hello</p>

### load() : jQuery

Trigger the load event of each matched element. This causes all of the functions that have been bound to thet load event to be executed.

Marked as private: Calling load() without arguments throws exception because the ajax load does not handle it.

#### Example

##### Before

    <p onload="alert('Hello');">Hello</p>

##### Code

    $("p").load();

##### Result

    alert('Hello');

### oneload(Function fn) : jQuery

fn | Function | A function to bind to the load event on each of the matched elements.

Bind a function to the load event of each matched element, which will only be executed once. Unlike a call to the normal .load() method, calling .oneload() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

#### Example

##### Before

    <p onload="alert('Hello');">Hello</p>

##### Code

    $("p").oneload( function() { alert("Hello"); } );

##### Result

    alert('Hello'); // Only executed for the first load

### unload(Function fn) : jQuery

fn | Function | A function to unbind from the load event on each of the matched elements.

Removes a bound load event from each of the matched elements. You must pass the identical function that was used in the original bind method.

#### Example

##### Before

    <p onload="myFunction">Hello</p>

##### Code

    $("p").unload( myFunction );

##### Result

    <p>Hello</p>

### unload() : jQuery

Removes all bound load events from each of the matched elements.

#### Example

##### Before

    <p onload="alert('Hello');">Hello</p>

##### Code

    $("p").unload();

##### Result

    <p>Hello</p>

### unload(Function fn) : jQuery

fn | Function | A function to bind to the unload event on each of the matched elements.

Bind a function to the unload event of each matched element.

#### Example

##### Before

    <p>Hello</p>

##### Code

    $("p").unload( function() { alert("Hello"); } );

##### Result

    <p onunload="alert('Hello');">Hello</p>

### unload() : jQuery

Trigger the unload event of each matched element. This causes all of the functions that have been bound to thet unload event to be executed.

#### Example

##### Before

    <p onunload="alert('Hello');">Hello</p>

##### Code

    $("p").unload();

##### Result

    alert('Hello');

### oneunload(Function fn) : jQuery

fn | Function | A function to bind to the unload event on each of the matched elements.

Bind a function to the unload event of each matched element, which will only be executed once. Unlike a call to the normal .unload() method, calling .oneunload() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

#### Example

##### Before

    <p onunload="alert('Hello');">Hello</p>

##### Code

    $("p").oneunload( function() { alert("Hello"); } );

##### Result

    alert('Hello'); // Only executed for the first unload

### ununload(Function fn) : jQuery

fn | Function | A function to unbind from the unload event on each of the matched elements.

Removes a bound unload event from each of the matched elements. You must pass the identical function that was used in the original bind method.

#### Example

##### Before

    <p onunload="myFunction">Hello</p>

##### Code

    $("p").ununload( myFunction );

##### Result

    <p>Hello</p>

### ununload() : jQuery

Removes all bound unload events from each of the matched elements.

#### Example

##### Before

    <p onunload="alert('Hello');">Hello</p>

##### Code

    $("p").ununload();

##### Result

    <p>Hello</p>

### resize(Function fn) : jQuery

fn | Function | A function to bind to the resize event on each of the matched elements.

Bind a function to the resize event of each matched element.

#### Example

##### Before

    <p>Hello</p>

##### Code

    $("p").resize( function() { alert("Hello"); } );

##### Result

    <p onresize="alert('Hello');">Hello</p>

### resize() : jQuery

Trigger the resize event of each matched element. This causes all of the functions that have been bound to thet resize event to be executed.

#### Example

##### Before

    <p onresize="alert('Hello');">Hello</p>

##### Code

    $("p").resize();

##### Result

    alert('Hello');

### oneresize(Function fn) : jQuery

fn | Function | A function to bind to the resize event on each of the matched elements.

Bind a function to the resize event of each matched element, which will only be executed once. Unlike a call to the normal .resize() method, calling .oneresize() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

#### Example

##### Before

    <p onresize="alert('Hello');">Hello</p>

##### Code

    $("p").oneresize( function() { alert("Hello"); } );

##### Result

    alert('Hello'); // Only executed for the first resize

### unresize(Function fn) : jQuery

fn | Function | A function to unbind from the resize event on each of the matched elements.

Removes a bound resize event from each of the matched elements. You must pass the identical function that was used in the original bind method.

#### Example

##### Before

    <p onresize="myFunction">Hello</p>

##### Code

    $("p").unresize( myFunction );

##### Result

    <p>Hello</p>

### unresize() : jQuery

Removes all bound resize events from each of the matched elements.

#### Example

##### Before

    <p onresize="alert('Hello');">Hello</p>

##### Code

    $("p").unresize();

##### Result

    <p>Hello</p>