Skip to content

Bind

Attaches a change event handler to the nodes selected by the specified XPath.

1
myXml.Bind(callback: (e: `CurrentTarget` : Xml

Gets the XML node to which the event handler is attached.

Target : Xml
Gets the XML node on which the event occurred.) => void):void

Attaches a change event handler to the nodes selected by the specified XPath.

1
myXml.Bind(xpath: string, callback: (e: `CurrentTarget` : Xml

Gets the XML node to which the event handler is attached.

Target : Xml
Gets the XML node on which the event occurred.) => void):void

Parameters

(e: CurrentTarget : Xml
Gets the XML node to which the event handler is attached.

Target : Xml
Gets the XML node on which the event occurred.) => void callback
    The callback function to execute.

string xpath
    The XPath of the nodes to attach to. If not specified, the current node is selected.

Remarks

This method is only available in client-side scripts such as Form scripts.

The Bind method only attaches to nodes that already exist. To receive notifications for both existing nodes and nodes created in the future, use the Xml.Live method. This method is only available in client-side scripts such as Form scripts.

The Bind method only attaches to nodes that already exist. To receive notifications for both existing nodes and nodes created in the future, use the Xml.Live method.

Receive an alert when a node changes

1
2
3
var isNameEmpty = $Xml.Bind('//Customer/Name', function() {
  alert('Customer name changed');
});

Receive an alert for any change in the current document

1
2
3
$Xml.Bind(function() {
  alert(this.LocalName() + ' changed.');
});

See Also