Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

Sys.UI.DomElement addCssClass Method

Adds a CSS class to a DOM element if the class is not already part of the DOM element. This member is static and can be invoked without creating an instance of the class.

Syntax

Sys.UI.DomElement.addCssClass(element, className);

Term

Definition

element

The Sys.UI.DomElement object to add the CSS class to.

className

The name of the CSS class to add.

Remarks

If the element does not support a CSS class, no change is made to the element.

Example

The following example shows how to use the addCssClass method. This code is part of a larger example found in the DomElement class overview.

cs

// Add CSS class
Sys.UI.DomElement.addCssClass($get("Button1"), "redBackgroundColor");

vb

// Add CSS class
Sys.UI.DomElement.addCssClass($get("Button1"), "redBackgroundColor");