mruben09 mruben09 - 4 months ago 5
jQuery Question

What are valid attributes to input as a parameter for element.contains()?

Question in short: What can I put as a the node parameter to

element.contains(node)
?

My understanding is that a node can be an element, attribute node, text, or something else. So why is it if I do
element.contains(datetime)
I receive an error? Other examples I have seen include
element.contains(span)
but I can't find an example of finding an attribute.

Thanks!

Answer

Short answer The official syntax is

node.contains(node)

node should be a node, not a string, or datetime

http://www.w3schools.com/jsref/met_node_contains.asp

My understanding is that a node can be an element, attribute node, text, or something else.

No, thats wrong. An element/node is actually just a <TAG> - Element

Comments