Edit this page

up.Layer up.Layer.prototype.affix(selector, attrs)
Class method

This feature is experimental. It may be changed or removed in a future version.

Creates an element with the given selector and appends it to this layer's outmost element.

Also see up.element.affix().

Example

layer = up.layer.open()
element = layer.affix(.klass')
element.parentElement // returns 'main'
element.className // returns 'klass'

Parameters

selector string

The CSS selector from which to create an element.

attrs Object

An object of attributes to set on the created element.

attrs.text Object

The text content of the created element.

attrs.style Object

An object of CSS properties that will be set as the inline style of the created element.

The given object may use kebab-case or camelCase keys.