Loads an external SVG file via an Ajax request and appends it to each element in the collection. The full DOM tree from the SVG image will be appended to the collection’s elements. This is distinct from appending an image using the image()
element method, where only a single DOM element to represent the image is added.
An optional callback
function is called after this has completed. If the replace
argument is true
, the container element(s) will be emptied before the loaded content is appended.
The callback
is passed two arguments: 1) a collection of the new contents and 2) the XMLHttpRequest object used to load the file. Within the callback, the this
object will be the original collection.
Pablo(demoElement).load('/villain.svg');