dojo.NodeList.addContent
<script src="../../js/dojo.js"></script>
defined in dojo/_base/NodeList.js
a copy of the HTML content is added to each item in the list, with an optional position argument. If no position argument is provided, the content is appended to the end of each item.
parameter | type | description |
---|---|---|
content | String | the HTML in string format to add at position to every item |
position | String|Integer | Optional. can be one of: * "last"||"end" (default) * "first||"start" * "before" * "after" or an offset in the childNodes property |
Examples
Example 1
appends content to the end if the position is ommitted
dojo.query("h3 > p").addContent("hey there!");
Example 2
add something to the front of each element that has a "thinger" property:
dojo.query("[thinger]").addContent("...", "first");
Example 3
adds a header before each element of the list
dojo.query(".note").addContent("
NOTE:
", "before");