New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

Definition

Namespace:Telerik.Web

Inheritance: Telerik.Web.CommonScripts

Methods

Adds multiple css classes to a DomElement

JS
static addCssClasses(Element element, Array classNames): void
Parameters:elementElement

The element to modify

classNamesArray

The class names to add

Adds the specified event handler to the element's eventName. Can be used when attaching events to HTML elements in IFRAMEs where ASP.NET AJAX's $addHandler and $removeHandler do not work

JS
static addExternalHandler(Element element, String eventName, Function handler): void
Parameters:elementElement

The HTML DOM element to attach an event handler to

eventNameString

The name of the event to attach an event handler to

handlerFunction

The event handler function

Provides a method to add a DOM event handler to the DOM element that exposes the event. This member is static and can be invoked without creating an instance of the class. This is basically a copy of $addHandler, but handles correctly IE proprietary events, such as "onpropertychange", in IE9.

JS
static addHandler(Element element, String eventName, Function handler, Boolean autoRemove): void
Parameters:elementElement

The HTML DOM element to attach an event handler to

eventNameString

The name of the event to attach an event handler to

handlerFunction

The event handler function

autoRemoveBoolean

A boolean value that determines whether the handler should be removed automatically when the element is disposed.

Adds a list of DOM event handlers to the DOM element that exposes the events. This member is static and can be invoked without creating an instance of the class. This is basically a copy of $addHandlers, but handles correctly IE proprietary events, such as "onpropertychange", in IE9.

JS
static addHandlers(Element element, Object events, Object handlerOwner, Boolean autoRemove): void
Parameters:elementElement

The DOM element that exposes the events.

eventsObject

A dictionary of event handlers.

handlerOwnerObject

The object instance that is the context for the delegates that should be created from the handlers.

autoRemoveBoolean

A boolean value that determines whether the handler should be removed automatically when the element is disposed.

Cancels the specified event from propagating

JS
static cancelRawEvent(Sys.UI.DomEvent e): Boolean
Parameters:eSys.UI.DomEvent

The event object of the event to cancel

Returns:

Boolean

Always returns false

Removes all DOM event handlers from a DOM element that were added through the Sys.UI.DomEvent addHandler or the Sys.UI.DomEvent addHandlers methods. This member is static and can be invoked without creating an instance of the class. This is basically a copy of $clearHandlers, but handles correctly IE proprietary events, such as "onpropertychange", in IE9.

JS
static clearHandlers(Element element): void
Parameters:elementElement

The element that exposes the events.

Clones the specified sourceControl RadControl client object with the optional specified type and saves it as an attribute to the HTML element representing the container DOM element of the RadControl

JS
static cloneControl(Telerik.Web.UI.RadWebControl sourceControl, Function optionalType, Element element): Telerik.Web.UI.RadWebControl
Parameters:sourceControlTelerik.Web.UI.RadWebControl

Source RadControl object to clone

optionalTypeFunction

Optional. The type of the cloned control

elementElement

The HTML DOM element of the cloned control

Returns:

Telerik.Web.UI.RadWebControl

The cloned RadWebControl object

Clones the source object to the target object and returns the cloned target object

JS
static cloneJsObject(Object source, Object target): Object
Parameters:sourceObject

The source JS object

targetObject

Optional. The target JS object

Returns:

Object

The cloned JS object

Tests whether a point (x,y) is contained within a rectangle

JS
static containsPoint(Object rect, Number x, Number y): void
Parameters:rectObject

The rectangle

xNumber

The x coordinate of the point

yNumber

The y coordinate of the point

Checks if the specified HTML element overflows the screen with the specified screen size from bottom

JS
static elementOverflowsBottom(Object screenSize, Element element, Sys.UI.Point cachedLocation): Boolean
Parameters:screenSizeObject

An Object

elementElement

HTML DOM element

cachedLocationSys.UI.Point

Optional. If a Point object is specified for this parameter

Returns:

Boolean

Checks if the specified HTML element overflows the screen with the specified screen size from left

JS
static elementOverflowsLeft(Element element, Sys.UI.Point cachedLocation): Boolean
Parameters:elementElement

HTML DOM element

cachedLocationSys.UI.Point

Optional. If a Point object is specified for this parameter

Returns:

Boolean

Checks if the specified HTML element overflows the screen with the specified screen size from right

JS
static elementOverflowsRight(Object screenSize, Element element, Sys.UI.Point cachedLocation): Boolean
Parameters:screenSizeObject

An Object

elementElement

HTML DOM element

cachedLocationSys.UI.Point

Optional. If a Point object is specified for this parameter

Returns:

Boolean

Checks if the specified HTML element overflows the screen with the specified screen size from top

JS
static elementOverflowsTop(Element element, Sys.UI.Point cachedLocation): Boolean
Parameters:elementElement

HTML DOM element

cachedLocationSys.UI.Point

Optional. If a Point object is specified for this parameter

Returns:

Boolean

Finds the client-side RadControl object by provided server-side ID of the RadControl object in the collection of child elements of the parent DOM element

JS
static findControl(Element parent, String id): Sys.UI.Control
Parameters:parentElement

The HTML DOM element that is a parent to the container element of the control to find

idString

The ID of the control to find

Returns:

Sys.UI.Control

Finds the HTML DOM wrapper element of the RadControl by provided server-side ID in the collection of child elements of the parent DOM element

JS
static findElement(Element parent, String id): Element
Parameters:parentElement

The HTML DOM element that is a parent to the container element of the control to find

idString

The ID of the control to find

Returns:

Element

Finds the closest scrollable parent element and changes its position to relative if static

JS
static fixScrollableParentBehavior_OldIE(Element element): void
Parameters:elementElement

HTML DOM element

Gets the entire border box sizes.

JS
static getBorderBox(Element element): Object
Parameters:elementElement

DOM element

Returns:

Object

Element

Gets the border thickness of an element on a specific boxSide.

JS
static getBorderWidth(Element element, Telerik.Web.BoxSide boxSide): Number
Parameters:elementElement

DOM element

boxSideTelerik.Web.BoxSide

Side of the element

Returns:

Number

Border thickness on the element

Gets the coordinates, width and height of an element.

JS
static getBounds(Element element): Sys.UI.Bounds
Parameters:elementElement

HTML DOM element whose bounds to retrieve

Returns:

Sys.UI.Bounds

A Bounds object with four fields

Returns the first child element of element with the specified className, optionally starting from position index

JS
static getChildByClassName(Element element, String className, Number index): Element
Parameters:elementElement

HTML DOM element whose children to search in

classNameString

The class name of the child element to search for

indexNumber

The index of the child element in the parent

Returns:

Element

Returns an array of all child elements of element with the specified className

JS
static getChildrenByClassName(Element element, String tagName): Array
Parameters:elementElement

HTML DOM element whose children to search in

tagNameString

The tag name of the child elements to search for

Returns:

Array

Returns an array of all child elements of element with the specified tag name

JS
static getChildrenByTagName(Element element, String tagName): Array
Parameters:elementElement

HTML DOM element whose children to search in

tagNameString

The tag name of the child elements to search for

Returns:

Array

Gets the width and height of the browser client window (excluding scrollbars)

JS
static getClientBounds(): Sys.UI.Bounds
Returns:

Sys.UI.Bounds

Browser

Gets the computed value of the attribute style of the specified element. If there's no computed value, optionally returns defaultValue

JS
static getComputedStyle(Element element, String attribute, String defaultValue): String
Parameters:elementElement

HTML DOM element whose style to retrieve

attributeString

The style attribute whose value to retrieve

defaultValueString

Optional. The default value to return if there is no value set

Returns:

String

The value of the specified style attribute

Gets the "content-box" size of an element.

JS
static getContentSize(Element element): Object
Parameters:elementElement

DOM element

Returns:

Object

Size of the element

Gets the current value of the attribute style of the specified element. If the current value is not defined, optionally returns defaultValue

JS
static getCurrentStyle(Element element, String attribute, String defaultValue): String
Parameters:elementElement

HTML DOM element whose style to retrieve

attributeString

The style attribute whose value to retrieve

defaultValueString

Optional. The default value to return if there is no value set

Returns:

String

The value of the specified style attribute

Gets the cursor position as Object {left, top} of the mouse when event e is fired, relative to the Document

JS
static getDocumentRelativeCursorPosition(Sys.UI.DomEvent e): Object
Parameters:eSys.UI.DomEvent

The event object of the current DOM event

Returns:

Object

Object

Returns the first child element of element widh the specified className and optionally of type tagName

JS
static getElementByClassName(Element element, String className, String tagName): Element
Parameters:elementElement

The parent HTML DOM element

classNameString

The class name of the element to retrieve

tagNameString

Optional. The tag name of the element to retrieve

Returns:

Element

Returns the first child of element with the specified tagName, starting from index in the collection of child elements

JS
static getFirstChildByTagName(Element element, String tagName, Number index): Element
Parameters:elementElement

HTML DOM element whose children to search in

tagNameString

The tag name of the child element to search for

indexNumber

The index of the child element in the parent

Returns:

Element

Returns the closest parent of element that has its display style set to "none", or null if no such parent is found

JS
static getInvisibleParent(Element element): Element
Parameters:elementElement

HTML DOM element

Returns:

Element

The first invisible parent HTML element

Returns the absolute location of element in the document

JS
static getLocation(Element element): Sys.UI.Point
Parameters:elementElement

The HTML DOM element whose position to retrieve

Returns:

Sys.UI.Point

A Point object contaning the location of the specified element

Gets the margin thickness of an element on a specific boxSide.

JS
static getMargin(Element element, Telerik.Web.BoxSide boxSide): Number
Parameters:elementElement

DOM element

boxSideTelerik.Web.BoxSide

Side of the element

Returns:

Number

Margin thickness on the element

Gets the entire margin box sizes.

JS
static getMarginBox(Element element): Object
Parameters:elementElement

DOM element

Returns:

Object

Element

Gets the next non-text HTML sibling of element

JS
static getNextHtmlNode(Element element): Element
Parameters:elementElement

HTML DOM element whose previous sibling to retrieve

Returns:

Element

Returns the outer bounds of an HTML DOM element

JS
static getOuterBounds(Element element): Sys.UI.Bounds
Parameters:elementElement

HTML DOM element

Returns:

Sys.UI.Bounds

An object containing the outer bounds of element

Returns the outer HTML text of an element (element's innerHTML and its own rendered HTML)

JS
static getOuterHtml(Element element): String
Parameters:elementElement

The HTML DOM element whose outer HTML text to retrieve

Returns:

String

Returns the outer size of an HTML DOM element

JS
static getOuterSize(Element element): Object
Parameters:elementElement

HTML DOM element

Returns:

Object

An object containing width and height of element

Gets the padding thickness of an element on a specific boxSide.

JS
static getPadding(Element element, Telerik.Web.BoxSide boxSide): Number
Parameters:elementElement

DOM element

boxSideTelerik.Web.BoxSide

Side of the element

Returns:

Number

Padding on the element

Gets the entire padding box sizes.

JS
static getPaddingBox(Element element): Object
Parameters:elementElement

DOM element

Returns:

Object

Element

Gets the previous non-text HTML sibling of element

JS
static getPreviousHtmlNode(Element element): Element
Parameters:elementElement

HTML DOM element whose previous sibling to retrieve

Returns:

Element

Returns the closest scrollable parent element or null if no such is found.

JS
static getScrollableParent(Element element): Element
Parameters:elementElement

HTML DOM element

Returns:

Element

Returns an array of all scrollable parent elements or an empty array if но such are found.

JS
static getScrollableParents(Element element): Array
Parameters:elementElement

HTML DOM element

Returns:

Array

Returns the scroll ofset of element from its parent(s). If recursive, return the absolute scroll offset

JS
static getScrollOffset(Element element, Boolean recursive): Sys.UI.Point
Parameters:elementElement

The HTML DOM element whose scroll offset to find

recursiveBoolean

Indicates whether to retrieve the scroll ofset of the element recursively. If true

Returns:

Sys.UI.Point

Gets the "border-box" size of an element.

JS
static getSize(Element element): Object
Parameters:elementElement

DOM element

Returns:

Object

Size of the element

Returns the effective size of the client viewport as Object {width, height}

JS
static getViewPortSize(): Object
Returns:

Object

An Object

Returns true if element is visible, otherwise returns false

JS
static getVisible(Element element): Boolean
Parameters:elementElement

HTML DOM element whose state to retrieve

Returns:

Boolean

Gets whether the current border style for an element on a specific boxSide is not "none".

JS
static isBorderVisible(Element element, Telerik.Web.BoxSide boxSide): Boolean
Parameters:elementElement

DOM element

boxSideTelerik.Web.BoxSide

Side of the element

Returns:

Boolean

Whether the current border style for an element on a specific boxSide is not

Whether the specified element is a descendant of the ancestor

JS
static isDescendant(Element ancestor, Element descendant): void
Parameters:ancestorElement

Ancestor node

descendantElement

Possible descendant node

Whether the specified element is a descendant of the ancestor or the same as the ancestor

JS
static isDescendantOrSelf(Element ancestor, Element descendant): void
Parameters:ancestorElement

Ancestor node

descendantElement

Possible descendant node

Returns Boolean value that indicates whether the page is opened under IE.

JS
isIE(): Boolean
Returns:

Boolean

Returns whether mouse is over element when event fires. See also isMouseOverElementEx

JS
static isMouseOverElement(Element element, Sys.UI.DomEvent e): Boolean
Parameters:elementElement

HTML DOM element

eSys.UI.DomEvent

The event object of the current DOM event

Returns:

Boolean

Returns whether mouse is over element when event fires. This method is more sophisticated and it is recommend that you use it instead of isMouseOverElement, which exists for historical reasons.

JS
static isMouseOverElementEx(Element element, Sys.UI.DomEvent e): Boolean
Parameters:elementElement

HTML DOM element

eSys.UI.DomEvent

The event object of the current DOM event

Returns:

Boolean

Returns Boolean value that indicates whether the page is opened under Opera.

JS
isOpera(): Boolean
Returns:

Boolean

Returns true if element is in RTL direction, otherwise returns false

JS
static isRightToLeft(Element element): Boolean
Parameters:elementElement

HTML DOM element

Returns:

Boolean

Returns Boolean value that indicates whether the page is opened under Safari.

JS
isSafari(): Boolean
Returns:

Boolean

Returns Boolean value that indicates whether the page is opened under a Mobile Device.

JS
isTouchDevice(): Boolean
Returns:

Boolean

Merges the atributes of source to target. If under IE, the optional preserve specifies whether to preserve the identity of target or to allow modification on merging

JS
static mergeElementAttributes(Element oSource, Element oTarget, Boolean bPreserve): void
Parameters:oSourceElement

Source HTML element

oTargetElement

Target HTML element

bPreserveBoolean

When in IE

Parses a border-width string into a pixel size

JS
static parseBorderWidth(String borderWidth): Number
Parameters:borderWidthString

Type of border

Returns:

Number

Number of pixels in the border

Parses a padding string into a pixel size

JS
static parsePadding(String padding): Number
Parameters:paddingString

Padding to parse

Returns:

Number

Number of pixels in the padding

Parses a unit string into a unit object

JS
static parseUnit(String value): Object
Parameters:valueString

Value to parse

Returns:

Object

Parsed unit

Registers all link style tags in element to the page. If no element is provided, all the link tags on page are registered

JS
static registerSkins(Element element): void
Parameters:elementElement

HTML DOM element contaning the links

Removes multiple css classes to a DomElement

JS
static removeCssClasses(Element element, Array classNames): void
Parameters:elementElement

The element to modify

classNamesArray

The class names to remove

Removes the event handler from an element's event. Can be used when attaching events to HTML elements in IFRAMEs where ASP.NET AJAX's $addHandler and $removeHandler do not work

JS
static removeExternalHandler(Element element, String eventName, Function handler): void
Parameters:elementElement

The HTML DOM element to attach an event handler to

eventNameString

The name of the event to attach an event handler to

handlerFunction

The event handler function

Removes a DOM event handler from the DOM element that exposes the event. This member is static and can be invoked without creating an instance of the class. This is basically a copy of $removeHandler, but handles correctly IE proprietary events, such as "onpropertychange", in IE9.

JS
static removeHandler(Element element, String eventName, Function handler): void
Parameters:elementElement

The element that exposes the event.

eventNameString

The name of the event.

handlerFunction

The event handler to remove.

Repaints all children elements of an element or a control's container

JS
static repaintChildren(Object parent): void
Parameters:parentObject

Scrolls the parent scrollable container to element's position. An alternative flicker-free implementation to HTMLDomElement.scrollIntoView()

JS
static scrollIntoView(Element element): void
Parameters:elementElement

HTML DOM element to scroll into view

Sets the "border-box" bounds of an element

JS
static setBounds(Element element, Object bounds): void
Parameters:elementElement

DOM element

boundsObject

Bounds of the element

Sets the "content-box" size of an element.

JS
static setContentSize(Element element, Object size): void
Parameters:elementElement

DOM element

sizeObject

Size of the element

Sets the location (left, top) of element to point (x, y)

JS
static setLocation(Element element, Sys.UI.Point point): void
Parameters:elementElement

The HTML DOM element whose location to set

pointSys.UI.Point

The Point object contaning the position values

Sets the "border-box" size of an element.

JS
static setSize(Element element, Object size): void
Parameters:elementElement

DOM element

sizeObject

Size of the element

Set the visibility of an element

JS
static setVisible(Element element, Boolean value): void
Parameters:elementElement

The HTML DOM element whose visibility to set

valueBoolean

A boolean value indicating whether the element should be hidden or made visible

Perform a custom animation of a set of CSS properties. The animation will be performed using CSS3 Transitions if browser supports them.

JS
static transition(Element element, Object properties, Number duration, String easing, Function complete): void
Parameters:elementElement

The DOM element or jQuery object that will be animated.

propertiesObject

Object of CSS properties and values that the animation will move toward.

durationNumber

String or number determining how long the animation will run

easingString

String indicating which easing function to use for the transition.

completeFunction

Function to call once the animation is complete.

A helper method that checks whether a DOM event handler should be added through addEventListener or through attachEvent, so that IE proprietary events, such as "onpropertychange", are handled correctly in IE9.

JS
static useAttachEvent(Element element): void
Parameters:elementElement

The element that exposes the event.

A helper method that checks whether a DOM event handler should be removed through removeEventListener or through detachEvent, so that IE proprietary events, such as "onpropertychange", are handled correctly in IE9.

JS
static useDetachEvent(Element element): void
Parameters:elementElement

The element that exposes the event.

Not finding the help you need?
Contact Support