Class CKEDITOR.dom.element
Extends
CKEDITOR.dom.node.
Defined in: core/dom/element.js.
Constructor Attributes | Constructor Name and Description |
---|---|
CKEDITOR.dom.element(element, ownerDocument)
Represents a DOM element.
|
Field Attributes | Field Name and Description |
---|---|
Checks if the specified attribute is defined for this element.
|
|
The node type.
|
- Fields borrowed from class CKEDITOR.dom.domObject:
- $, removeCustomData
Method Attributes | Method Name and Description |
---|---|
<static> |
CKEDITOR.dom.element.clearAllMarkers(database)
|
<static> |
CKEDITOR.dom.element.clearMarkers(database, element, removeFromDatabase)
|
<static> |
CKEDITOR.dom.element.createFromHtml(html, ownerDocument)
Creates an instance of the CKEDITOR.dom.element class based on the
HTML representation of an element.
|
<static> |
CKEDITOR.dom.element.get(element)
The the CKEDITOR.dom.element representing and element.
|
<static> |
CKEDITOR.dom.element.setMarker(database, element, name, value)
|
addClass(className)
Adds a CSS class to the element.
|
|
append(node, toStart)
Append a node as a child of this element.
|
|
appendHtml(html)
|
|
appendText(text)
Append text to this element.
|
|
breakParent(parent)
Breaks one of the ancestor element in the element position, moving
this element between the broken parts.
|
|
copyAttributes(dest, skipAttributes)
Copy all the attributes from one node to the other, kinda like a clone
skipAttributes is an object with the attributes that must NOT be copied.
|
|
data(name, value)
Gets, sets and removes custom data to be stored as HTML5 data-* attributes.
|
|
focus(defer)
Moves the selection focus to this element.
|
|
focusNext(ignoreChildren, indexToUse)
Moves the UI focus to the element following this element in the tabindex
order.
|
|
focusPrevious(ignoreChildren, indexToUse)
Moves the UI focus to the element before this element in the tabindex order.
|
|
getAttribute(name)
Gets the value of an element attribute.
|
|
getBogus()
|
|
getChild(indices)
Gets a DOM tree descendant under the current node.
|
|
getComputedStyle(propertyName)
Gets the current computed value of one of the element CSS style
properties.
|
|
getDirection(useComputed)
Gets element's direction.
|
|
getDocumentPosition(refDocument)
|
|
getDtd()
Gets the DTD entries for this element.
|
|
getFirst(evaluator)
Gets the first child node of this element.
|
|
Returns the inner document of this IFRAME element.
|
|
getHtml()
Gets the inner HTML of this element.
|
|
getId()
Gets the value of the "id" attribute of this element.
|
|
getLast(evaluator)
|
|
getName()
Gets the element name (tag name).
|
|
Gets the value of the "name" attribute of this element.
|
|
getSize(type, isBorderBox)
Gets the element size, possibly considering the box model.
|
|
getStyle(name)
|
|
Gets the computed tabindex for this element.
|
|
getText()
Gets the text value of this element.
|
|
getValue()
Gets the value set to this element.
|
|
Gets the window object that contains this element.
|
|
Checks if the element has any defined attributes.
|
|
hasClass(className)
|
|
hide()
Hides this element (display:none).
|
|
is()
Checks if the element name matches one or more names.
|
|
isBlockBoundary(customNodeNames)
|
|
isEditable(textCursor)
Decide whether one element is able to receive cursor.
|
|
Whether it's an empty inline elements which has no visual impact when removed.
|
|
isIdentical(otherElement)
|
|
Checks if this element is visible.
|
|
mergeSiblings(inlineOnly)
Merges sibling elements that are identical to this one.
|
|
moveChildren(target, toStart)
|
|
removeAttribute(name)
Removes an attribute from the element.
|
|
removeAttributes(attributes)
|
|
removeClass(className)
Removes a CSS class name from the elements classes.
|
|
removeStyle(name)
Removes a style from the element.
|
|
renameNode(newTag)
Changes the tag name of the current element.
|
|
scrollIntoParent(parent, alignToTop, hscroll)
Make any page element visible inside one of the ancestors by scrolling the parent.
|
|
scrollIntoView(alignToTop)
Make any page element visible inside the browser viewport.
|
|
setAttribute(name, value)
Sets the value of an element attribute.
|
|
setAttributes(attributesPairs)
Sets the value of several element attributes.
|
|
setHtml(html)
Sets the inner HTML of this element.
|
|
setOpacity(opacity)
Sets the opacity of an element.
|
|
setSize(type, size, isBorderBox)
Sets the element size considering the box model.
|
|
setState(state)
|
|
setStyle(name, value)
Sets the value of an element style.
|
|
setStyles(stylesPairs)
Sets the value of several element styles.
|
|
setText(text)
Sets the element contents as plain text.
|
|
setValue(value)
Sets the element value.
|
|
show()
Shows this element (display it).
|
|
Makes the element and its children unselectable.
|
- Methods borrowed from class CKEDITOR.dom.node:
- appendTo, clone, getAddress, getAscendant, getCommonAncestor, getDocument, getIndex, getNext, getNextSourceNode, getParent, getParents, getPosition, getPrevious, getPreviousSourceNode, hasAscendant, hasNext, hasPrevious, insertAfter, insertBefore, insertBeforeMe, isReadOnly, ltrim, move, remove, replace, rtrim, trim
- Methods borrowed from class CKEDITOR.dom.domObject:
- clearCustomData, equals, getCustomData, getPrivate, getUniqueId, removeAllListeners, setCustomData
- Methods borrowed from class CKEDITOR.event:
- fire, fireOnce, hasListeners, on, removeListener
Class Detail
CKEDITOR.dom.element(element, ownerDocument)
Since:
3.0
Represents a DOM element.
// Create a new <span> element. var element = new CKEDITOR.dom.element( 'span' );
// Create an element based on a native DOM element. var element = new CKEDITOR.dom.element( document.getElementById( 'myId' ) );
- Parameters:
- {Object|String} element
- A native DOM element or the element name for new elements.
- {CKEDITOR.dom.document} ownerDocument Optional
- The document that will contain the element in case of element creation.
Field Detail
{Boolean}
hasAttribute
Since:
3.0
Checks if the specified attribute is defined for this element.
{Number}
type
Since:
3.0
The node type. This is a constant value set to
CKEDITOR.NODE_ELEMENT.
Method Detail
<static>
{Undefined}
CKEDITOR.dom.element.clearAllMarkers(database)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} database
<static>
{Undefined}
CKEDITOR.dom.element.clearMarkers(database, element, removeFromDatabase)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} database
- {Undefined} element
- {Undefined} removeFromDatabase
<static>
{CKEDITOR.dom.element}
CKEDITOR.dom.element.createFromHtml(html, ownerDocument)
Since:
3.0
Creates an instance of the CKEDITOR.dom.element class based on the
HTML representation of an element.
var element = CKEDITOR.dom.element.createFromHtml( '<strong class="anyclass">My element</strong>' ); alert( element.getName() ); // "strong"
- Parameters:
- {String} html
- The element HTML. It should define only one element in the "root" level. The "root" element can have child nodes, but not siblings.
- {Undefined} ownerDocument
- Returns:
- {CKEDITOR.dom.element} The element instance.
<static>
{CKEDITOR.dom.element}
CKEDITOR.dom.element.get(element)
Since:
3.0
The the CKEDITOR.dom.element representing and element. If the
element is a native DOM element, it will be transformed into a valid
CKEDITOR.dom.element object.
var element = new CKEDITOR.dom.element( 'span' ); alert( element == CKEDITOR.dom.element.get( element ) ); "true"
var element = document.getElementById( 'myElement' ); alert( CKEDITOR.dom.element.get( element ).getName() ); e.g. "p"
- Parameters:
- {Undefined} element
- Returns:
- {CKEDITOR.dom.element} The transformed element.
<static>
{Undefined}
CKEDITOR.dom.element.setMarker(database, element, name, value)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} database
- {Undefined} element
- {Undefined} name
- {Undefined} value
{Undefined}
addClass(className)
Since:
3.0
Adds a CSS class to the element. It appends the class to the
already existing names.
var element = new CKEDITOR.dom.element( 'div' ); element.addClass( 'classA' ); // <div class="classA"> element.addClass( 'classB' ); // <div class="classA classB"> element.addClass( 'classA' ); // <div class="classA classB">
- Parameters:
- {String} className
- The name of the class to be added.
{CKEDITOR.dom.node}
append(node, toStart)
Since:
3.0
Append a node as a child of this element.
var p = new CKEDITOR.dom.element( 'p' ); var strong = new CKEDITOR.dom.element( 'strong' ); p.append( strong ); var em = p.append( 'em' ); // result: "<p><strong></strong><em></em></p>"
- Parameters:
- {CKEDITOR.dom.node|String} node
- The node or element name to be appended.
- {Boolean} toStart Optional
- Indicates that the element is to be appended at the start.
- Returns:
- {CKEDITOR.dom.node} The appended node.
{Undefined}
appendBogus()
Since:
3.0
NO EXAMPLE AVAILABLE
{Undefined}
appendHtml(html)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} html
{CKEDITOR.dom.node}
appendText(text)
Since:
3.0
Append text to this element.
var p = new CKEDITOR.dom.element( 'p' ); p.appendText( 'This is' ); p.appendText( ' some text' ); // result: "<p>This is some text</p>"
- Parameters:
- {String} text
- The text to be appended.
- Returns:
- {CKEDITOR.dom.node} The appended node.
{Undefined}
breakParent(parent)
Since:
3.0
Breaks one of the ancestor element in the element position, moving
this element between the broken parts.
// Before breaking: // <b>This <i>is some<span /> sample</i> test text</b> // If "element" is <span /> and "parent" is <i>: // <b>This <i>is some</i><span /><i> sample</i> test text</b> element.breakParent( parent );
// Before breaking: // <b>This <i>is some<span /> sample</i> test text</b> // If "element" is <span /> and "parent" is <b>: // <b>This <i>is some</i></b><span /><b><i> sample</i> test text</b> element.breakParent( parent );
- Parameters:
- {CKEDITOR.dom.element} parent
- The anscestor element to get broken.
{Undefined}
copyAttributes(dest, skipAttributes)
Since:
3.0
Copy all the attributes from one node to the other, kinda like a clone
skipAttributes is an object with the attributes that must NOT be copied.
- Parameters:
- {CKEDITOR.dom.element} dest
- The destination element.
- {Object} skipAttributes
- A dictionary of attributes to skip.
{Undefined}
data(name, value)
Since:
3.0
Gets, sets and removes custom data to be stored as HTML5 data-* attributes.
element.data( 'extra-info', 'test' ); // appended the attribute data-extra-info="test" to the element alert( element.data( 'extra-info' ) ); // "test" element.data( 'extra-info', false ); // remove the data-extra-info attribute from the element
- Parameters:
- {String} name
- The name of the attribute, excluding the 'data-' part.
- {String} value Optional
- The value to set. If set to false, the attribute will be removed.
{Undefined}
disableContextMenu()
Since:
3.0
NO EXAMPLE AVAILABLE
{Undefined}
focus(defer)
Since:
3.0
Moves the selection focus to this element.
var element = CKEDITOR.document.getById( 'myTextarea' ); element.focus();
- Parameters:
- {Boolean} defer
- Whether to asynchronously defer the execution by 100 ms.
{Undefined}
focusNext(ignoreChildren, indexToUse)
Since:
3.0
Moves the UI focus to the element following this element in the tabindex
order.
Defined in: plugins/tab/plugin.js.
Defined in: plugins/tab/plugin.js.
var element = CKEDITOR.document.getById( 'example' ); element.focusNext();
- Parameters:
- {Undefined} ignoreChildren
- {Undefined} indexToUse
{Undefined}
focusPrevious(ignoreChildren, indexToUse)
Since:
3.0
Moves the UI focus to the element before this element in the tabindex order.
Defined in: plugins/tab/plugin.js.
Defined in: plugins/tab/plugin.js.
var element = CKEDITOR.document.getById( 'example' ); element.focusPrevious();
- Parameters:
- {Undefined} ignoreChildren
- {Undefined} indexToUse
{String}
getAttribute(name)
Since:
3.0
Gets the value of an element attribute.
var element = CKEDITOR.dom.element.createFromHtml( '<input type="text" />' ); alert( element.getAttribute( 'type' ) ); // "text"
- Parameters:
- {String} name
- The attribute name.
- Returns:
- {String} The attribute value or null if not defined.
{Undefined}
getBogus()
Since:
3.0
Defined in: core/dom/walker.js.
NO EXAMPLE AVAILABLE
{CKEDITOR.dom.node}
getChild(indices)
Since:
3.0
Gets a DOM tree descendant under the current node.
var strong = p.getChild(0);
- Parameters:
- {Array|Number} indices
- The child index or array of child indices under the node.
- Returns:
- {CKEDITOR.dom.node} The specified DOM child under the current node. Null if child does not exist.
{Undefined}
getChildCount()
Since:
3.0
NO EXAMPLE AVAILABLE
{Undefined}
getChildren()
Since:
3.0
NO EXAMPLE AVAILABLE
{String}
getComputedStyle(propertyName)
Since:
3.0
Gets the current computed value of one of the element CSS style
properties.
var element = new CKEDITOR.dom.element( 'span' ); alert( element.getComputedStyle( 'display' ) ); // "inline"
- Parameters:
- {String} propertyName
- The style property name.
- Returns:
- {String} The property value.
{Undefined}
getDirection(useComputed)
Since:
3.0
Gets element's direction. Supports both CSS 'direction' prop and 'dir' attr.
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} useComputed
{Undefined}
getDocumentPosition(refDocument)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} refDocument
{Object}
getDtd()
Since:
3.0
Gets the DTD entries for this element.
NO EXAMPLE AVAILABLE
- Returns:
- {Object} An object containing the list of elements accepted by this element.
{CKEDITOR.dom.node}
getFirst(evaluator)
Since:
3.0
Gets the first child node of this element.
var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b></div>' ); var first = element.getFirst(); alert( first.getName() ); // "b"
- Parameters:
- {Function} evaluator
- Filtering the result node.
- Returns:
- {CKEDITOR.dom.node} The first child node or null if not available.
{CKEDITOR.dom.document}
getFrameDocument()
Since:
3.0
Returns the inner document of this IFRAME element.
NO EXAMPLE AVAILABLE
- Returns:
- {CKEDITOR.dom.document} The inner document.
{String}
getHtml()
Since:
3.0
Gets the inner HTML of this element.
var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b></div>' ); alert( p.getHtml() ); // "<b>Example</b>"
- Returns:
- {String} The inner HTML of this element.
{String}
getId()
Since:
3.0
Gets the value of the "id" attribute of this element.
var element = CKEDITOR.dom.element.createFromHtml( '<p id="myId"></p>' ); alert( element.getId() ); // "myId"
- Returns:
- {String} The element id, or null if not available.
{Undefined}
getLast(evaluator)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Function} evaluator
- Filtering the result node.
{String}
getName()
Since:
3.0
Gets the element name (tag name). The returned name is guaranteed to
be always full lowercased.
var element = new CKEDITOR.dom.element( 'span' ); alert( element.getName() ); // "span"
- Returns:
- {String} The element name.
{String}
getNameAtt()
Since:
3.0
Gets the value of the "name" attribute of this element.
var element = CKEDITOR.dom.element.createFromHtml( '<input name="myName"></input>' ); alert( element.getNameAtt() ); // "myName"
- Returns:
- {String} The element name, or null if not available.
{Undefined}
getOuterHtml()
Since:
3.0
NO EXAMPLE AVAILABLE
{Undefined}
getPositionedAncestor()
Since:
3.0
NO EXAMPLE AVAILABLE
{Undefined}
getSize(type, isBorderBox)
Since:
3.0
Gets the element size, possibly considering the box model.
NO EXAMPLE AVAILABLE
- Parameters:
- {String} type
- The dimension to get. It accepts "width" and "height".
- {Boolean} isBorderBox
- Get the size based on the border box model.
{Undefined}
getStyle(name)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} name
{Number}
getTabIndex()
Since:
3.0
Gets the computed tabindex for this element.
var element = CKEDITOR.document.getById( 'myDiv' ); alert( element.getTabIndex() ); // e.g. "-1"
- Returns:
- {Number} The tabindex value.
{String}
getText()
Since:
3.0
Gets the text value of this element.
Only in IE (which uses innerText), <br> will cause linebreaks,
and sucessive whitespaces (including line breaks) will be reduced to
a single space. This behavior is ok for us, for now. It may change
in the future.
var element = CKEDITOR.dom.element.createFromHtml( '<div>Sample <i>text</i>.</div>' ); alert( element.getText() ); // "Sample text."
- Returns:
- {String} The text value.
{String}
getValue()
Since:
3.0
Gets the value set to this element. This value is usually available
for form field elements.
NO EXAMPLE AVAILABLE
- Returns:
- {String} The element value.
{CKEDITOR.dom.window}
getWindow()
Since:
3.0
Gets the window object that contains this element.
- Returns:
- {CKEDITOR.dom.window} The window object.
{Boolean}
hasAttributes()
Since:
3.0
Checks if the element has any defined attributes.
var element = CKEDITOR.dom.element.createFromHtml( '<div title="Test">Example</div>' ); alert( element.hasAttributes() ); // "true"
var element = CKEDITOR.dom.element.createFromHtml( '<div>Example</div>' ); alert( element.hasAttributes() ); // "false"
- Returns:
- {Boolean} True if the element has attributes.
{Undefined}
hasClass(className)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} className
{Undefined}
hide()
Since:
3.0
Hides this element (display:none).
var element = CKEDITOR.dom.element.getById( 'myElement' ); element.hide();
{Boolean}
is()
Since:
3.0
Checks if the element name matches one or more names.
var element = new CKEDITOR.element( 'span' ); alert( element.is( 'span' ) ); "true" alert( element.is( 'p', 'span' ) ); "true" alert( element.is( 'p' ) ); "false" alert( element.is( 'p', 'div' ) ); "false"
- Parameters:
- {String} name[,name[,...]]
- One or more names to be checked.
- Returns:
- {Boolean} true if the element name matches any of the names.
{Undefined}
isBlockBoundary(customNodeNames)
Since:
3.0
Defined in: core/dom/walker.js.
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} customNodeNames
{Undefined}
isEditable(textCursor)
Since:
3.0
Decide whether one element is able to receive cursor.
NO EXAMPLE AVAILABLE
- Parameters:
- {Boolean} textCursor Optional, Default: true
- Only consider element that could receive text child.
{Undefined}
isEmptyInlineRemoveable()
Since:
3.0
Whether it's an empty inline elements which has no visual impact when removed.
NO EXAMPLE AVAILABLE
{Undefined}
isIdentical(otherElement)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} otherElement
{Boolean}
isVisible()
Since:
3.0
Checks if this element is visible. May not work if the element is
child of an element with visibility set to "hidden", but works well
on the great majority of cases.
NO EXAMPLE AVAILABLE
- Returns:
- {Boolean} True if the element is visible.
{Undefined}
mergeSiblings(inlineOnly)
Since:
3.0
Merges sibling elements that are identical to this one.
Identical child elements are also merged. For example:
<b><i></i></b><b><i></i></b> => <b><i></i></b>
Identical child elements are also merged. For example:
<b><i></i></b><b><i></i></b> => <b><i></i></b>
NO EXAMPLE AVAILABLE
- Parameters:
- {Boolean} inlineOnly Optional
- Allow only inline elements to be merged. Defaults to "true".
{Undefined}
moveChildren(target, toStart)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} target
- {Undefined} toStart
{Undefined}
removeAttribute(name)
Since:
3.0
Removes an attribute from the element.
var element = CKEDITOR.dom.element.createFromHtml( '' ); element.removeAttribute( 'class' );
- Parameters:
- {String} name
- The attribute name.
{Undefined}
removeAttributes(attributes)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} attributes
{Undefined}
removeClass(className)
Since:
3.0
Removes a CSS class name from the elements classes. Other classes
remain untouched.
var element = new CKEDITOR.dom.element( 'div' ); element.addClass( 'classA' ); // <div class="classA"> element.addClass( 'classB' ); // <div class="classA classB"> element.removeClass( 'classA' ); // <div class="classB"> element.removeClass( 'classB' ); // <div>
- Parameters:
- {String} className
- The name of the class to remove.
{Undefined}
removeStyle(name)
Since:
3.0
Removes a style from the element.
var element = CKEDITOR.dom.element.createFromHtml( '' ); element.removeStyle( 'display' );
- Parameters:
- {String} name
- The style name.
{Undefined}
renameNode(newTag)
Since:
3.0
Changes the tag name of the current element.
NO EXAMPLE AVAILABLE
- Parameters:
- {String} newTag
- The new tag for the element.
{Undefined}
scrollIntoParent(parent, alignToTop, hscroll)
Since:
3.0
Make any page element visible inside one of the ancestors by scrolling the parent.
NO EXAMPLE AVAILABLE
- Parameters:
- {CKEDITOR.dom.element|CKEDITOR.dom.window} parent
- The container to scroll into.
- {Boolean} alignToTop Optional
- Align the element's top side with the container's
when
true
is specified; align the bottom with viewport bottom whenfalse
is specified. Otherwise scroll on either side with the minimum amount to show the element. - {Boolean} hscroll Optional
- Whether horizontal overflow should be considered.
{Undefined}
scrollIntoView(alignToTop)
Since:
3.0
Make any page element visible inside the browser viewport.
NO EXAMPLE AVAILABLE
- Parameters:
- {Boolean} alignToTop Optional
{CKEDITOR.dom.element}
setAttribute(name, value)
Since:
3.0
Sets the value of an element attribute.
var element = CKEDITOR.dom.element.getById( 'myElement' ); element.setAttribute( 'class', 'myClass' ); element.setAttribute( 'title', 'This is an example' );
- Parameters:
- {String} name
- The name of the attribute.
- {String} value
- The value to be set to the attribute.
- Returns:
- {CKEDITOR.dom.element} This element instance.
{CKEDITOR.dom.element}
setAttributes(attributesPairs)
Since:
3.0
Sets the value of several element attributes.
var element = CKEDITOR.dom.element.getById( 'myElement' ); element.setAttributes({ 'class' : 'myClass', 'title' : 'This is an example' });
- Parameters:
- {Object} attributesPairs
- An object containing the names and values of the attributes.
- Returns:
- {CKEDITOR.dom.element} This element instance.
{String}
setHtml(html)
Since:
3.0
Sets the inner HTML of this element.
var p = new CKEDITOR.dom.element( 'p' ); p.setHtml( '<b>Inner</b> HTML' ); // result: "<p><b>Inner</b> HTML</p>"
- Parameters:
- {String} html
- The HTML to be set for this element.
- Returns:
- {String} The inserted HTML.
{Undefined}
setOpacity(opacity)
Since:
3.0
Sets the opacity of an element.
var element = CKEDITOR.dom.element.getById( 'myElement' ); element.setOpacity( 0.75 );
- Parameters:
- {Number} opacity
- A number within the range [0.0, 1.0].
{Undefined}
setSize(type, size, isBorderBox)
Since:
3.0
Sets the element size considering the box model.
NO EXAMPLE AVAILABLE
- Parameters:
- {String} type
- The dimension to set. It accepts "width" and "height".
- {Number} size
- The length unit in px.
- {Boolean} isBorderBox
- Apply the size based on the border box model.
{Undefined}
setState(state)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} state
{CKEDITOR.dom.element}
setStyle(name, value)
Since:
3.0
Sets the value of an element style.
var element = CKEDITOR.dom.element.getById( 'myElement' ); element.setStyle( 'background-color', '#ff0000' ); element.setStyle( 'margin-top', '10px' ); element.setStyle( 'float', 'right' );
- Parameters:
- {String} name
- The name of the style. The CSS naming notation must be used (e.g. "background-color").
- {String} value
- The value to be set to the style.
- Returns:
- {CKEDITOR.dom.element} This element instance.
{CKEDITOR.dom.element}
setStyles(stylesPairs)
Since:
3.0
Sets the value of several element styles.
var element = CKEDITOR.dom.element.getById( 'myElement' ); element.setStyles({ 'position' : 'absolute', 'float' : 'right' });
- Parameters:
- {Object} stylesPairs
- An object containing the names and values of the styles.
- Returns:
- {CKEDITOR.dom.element} This element instance.
{String}
setText(text)
Since:
3.0
Sets the element contents as plain text.
var element = new CKEDITOR.dom.element( 'div' ); element.setText( 'A > B & C < D' ); alert( element.innerHTML ); // "A > B & C < D"
- Parameters:
- {String} text
- The text to be set.
- Returns:
- {String} The inserted text.
{CKEDITOR.dom.element}
setValue(value)
Since:
3.0
Sets the element value. This function is usually used with form
field element.
NO EXAMPLE AVAILABLE
- Parameters:
- {String} value
- The element value.
- Returns:
- {CKEDITOR.dom.element} This element instance.
{Undefined}
show()
Since:
3.0
Shows this element (display it).
var element = CKEDITOR.dom.element.getById( 'myElement' ); element.show();
{Undefined}
unselectable()
Since:
3.0
Makes the element and its children unselectable.
var element = CKEDITOR.dom.element.getById( 'myElement' ); element.unselectable();