Node 'contains' method in JavaScript DOM | Node.prototype.contains() Explained

Publié le: 28 mars 2018
sur la chaîne: dcode
2,497
53

The 'contains' method found on the Node prototype (Node.prototype.contains) allows you to check whether or not a given Node is contained within another Node - this will give you a true or false return value. It works not only on direct child nodes but also on children of children (the entire subtree).

This method is part of the Document Object Model (DOM) in JavaScript.

In this video I show you a simple example of how exactly this method works using an unordered list element (ul) and a few list item elements (li). It's quite a simple method that could be useful in your future projects.

For your reference, check this out:
https://developer.mozilla.org/en-US/d...

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!


Sur cette page du site, vous pouvez voir la vidéo en ligne Node 'contains' method in JavaScript DOM | Node.prototype.contains() Explained durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur dcode 28 mars 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 2,497 fois et il a aimé 53 téléspectateurs. Bon visionnage!