SourceForge.net Logo

Taconite Actions

You can see that the Taconite response XML is quite easy to use. These are the available Taconite actions that you can use. Note that as of Taconite 3.1, instead of using "taconite-" named actions, you can usually use the jQuery DOM manipulation method name equivalent.

taconite-append-as-children (or append)

Append the specified content to the specified element(s).

<taconite-append-as-children selector="body">
    <![CDATA[
        <p>End of page.</p>
    ]]>
</taconite-append-as-children>
<append selector="body">
    <![CDATA[
        <p>End of page.</p>
    ]]>
</append>
                    

taconite-append-as-first-child (or prepend)

Append the specified content as the first child(ren) of the specified element(s).

<taconite-append-first-child selector="body">
    <![CDATA[
        <p>Start of page.</p>
    ]]>
</taconite-append-as-first-child>
<prepend selector="body">
    <![CDATA[
        <p>Start of page.</p>
    ]]>
</prepend>
                    

taconite-insert-before (or before)

Append the specified content before the specified element(s).

<taconite-insert-before selector="#item1">
    <![CDATA[
        <li>Now I am the first item!</li>
    ]]>
</taconite-insert-before>
<before selector="#item1">
    <![CDATA[
        <li>Now I am the first item!</li>
    ]]>
</before>
                    

taconite-insert-after (or after)

Append the specified content after the specified element(s).

<taconite-insert-after selector="#item1">
    <![CDATA[
        <li>Now I am the second item.</li>
    ]]>
</taconite-insert-after>
<after selector="#item1">
    <![CDATA[
        <li>Now I am the second item.</li>
    ]]>
</after>
                    

taconite-replace-children (or html)

Replace all child elements of the specified element(s) with the specified content.

<taconite-replace-children selector=".titles">
    <![CDATA[
        <option value="mr">Mr.</option>
        <option value="mrs">Mrs.</option>
        <option value="ms">Ms.</option>
    ]]>
</taconite-replace-children>
<html selector=".titles">
    <![CDATA[
        <option value="mr">Mr.</option>
        <option value="mrs">Mrs.</option>
        <option value="ms">Ms.</option>
    ]]>
</html>
                    

taconite-replace (or replace)

Completely replace the specified element(s) with the specified content.

<taconite-replace selector="#messages">
    <![CDATA[
        <p>I replaced an element that had an ID of "messages".</p>
    ]]>
</taconite-replace>
<replace selector="#messages">
    <![CDATA[
        <p>I replaced an element that had an ID of "messages".</p>
    ]]>
</replace>
                    

taconite-set-attributes (or attributes)

Set the attribute values on the specified DOM elements. All attribute name/value pairs (other than selector and contextNodeID) will be set on the specified elements.

<taconite-set-attributes selector=".link" href="http://taconite.sf.net" rel="newvalue" />
<attributes selector=".link" href="http://taconite.sf.net" rel="newvalue" />
                    

taconite-execute-javascript (or js)

Execute/evaluate the specified JavaScript.

<taconite-execute-javascript>
    <![CDATA[
        alert("hello!!");
    ]]>
</taconite-execute-javascript>
<js>
    <![CDATA[
        alert("hello!!");
    ]]>
</js>
                    

taconite-redirect (or redirect)

Redirect the browser to the specified URL.

<taconite-redirect targetUrl="http://taconite.sf.net" />
<redirect targetUrl="http://taconite.sf.net" />
                    

taconite-delete (or remove)

Delete the specfied elements from the DOM.

<taconite-delete selector=".buttons" /></taconite-delete>                    
<remove selector=".buttons" /></taconite-delete>                    
                    

action tag with name attribute

If you prefer, you can use an "action" tag with a "name" attribute to name the action. Some folks prefer this format as it makes it easier to change the action name -- chang it in one place (the name attribute) instead of two places (the start and end tag).

<action name="replace" selector="#messages">
    <![CDATA[
        <p>I replaced an element that had an ID of "messages".</p>
    ]]>
</action>
<action name="html" selector="#someDiv">
    <![CDATA[
        <p>I replaced the content of an element with an ID of "someDiv".</p>
    ]]>
</action>