owns()
Since: DateTime 1.0.0
Check if an element belongs to this control.
Please note - this property requires the DateTime extension for DataTables.
Description
This method takes a node as a parameter and returns true
if it belongs to this control, false
if not. It can be useful to know this information when creating a form that has multiple click event handlers and you might need to know if a click happens inside the date picker, or elsewhere in your form.
Type
owns(node)
Check if an element belongs to this control.
Parameters:
Name | Type | Optional | |
---|---|---|---|
1 | node | No | |
Element to check. |
Returns:
boolean``true
if owned by this control, false
otherwise.
Example
:
var dt = new DateTime(document.getElementById('example'));
if (dt.owns(document.getElementByClassName('dt-datetime-date'))) {
console.log('It is owned');
}