append() public method

The markup will be inserted into each match in the set. The same element cannot be inserted multiple times into a document. DOM documents do not allow a single object to be inserted multiple times into the DOM. To insert the same XML repeatedly, we must first clone the object. This has one practical implication: Once you have inserted an element into the object, you cannot further manipulate the original element and expect the changes to be replciated in the appended object. (They are not the same -- there is no shared reference.) Instead, you will need to retrieve the appended object and operate on that.
See also: appendTo()
See also: prepend()
public append ( mixed $data )
$data mixed This can be either a string (the usual case), or a DOM Element.
示例#1
0
 /**
  * Attach any items from the list if they match the selector.
  *
  * If no selector is specified, this will remove all current matches from
  * the document.
  *
  * @param DOMQuery $dest
  *  A DOMQuery Selector.
  * @retval object DOMQuery
  *  The Query path wrapping a list of removed items.
  * @see replaceAll()
  * @see replaceWith()
  * @see removeChildren()
  * @since 2.1
  * @author eabrand
  */
 public function attach(DOMQuery $dest)
 {
     foreach ($this->last as $m) {
         $dest->append($m);
     }
     return $this;
 }