HTML Component

A component which allows for the insertion of arbitrary HTML into a DOM entity.

Adding this to an entity will automatically add the DOM component.

Methods

Back to top

.append()

public this .append(String html)
html

arbitrary html

This method will add the supplied html in the end of the entity

Example

Create a link

Crafty.e("HTML")
   .attr({x:20, y:20, w:100, h:100})
   .append("<a href='index.html'>Index</a>");
Back to top

.prepend()

public this .prepend(String html)
html

arbitrary html

This method will add the supplied html in the beginning of the entity

Example

Create a link

Crafty.e("HTML")
   .attr({x:20, y:20, w:100, h:100})
   .prepend("<a href='index.html'>Index</a>");
Back to top

.replace()

public this .replace(String html)
html

arbitrary html

This method will replace the content of this entity with the supplied html

Example

Create a link

Crafty.e("HTML")
   .attr({x:20, y:20, w:100, h:100})
   .replace("<a href='index.html'>Index</a>");