1. Tecnología web para desarrolladores
  2. API web
  3. Node
  4. Node.parentElement

Esta página ha sido traducida del inglés por la comunidad. Aprende más y únete a la comunidad de MDN Web Docs.

View in English Always switch to English

Node.parentElement

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since julio de 2015.

La propiedad de sólo lectura de Nodo.parentElement devuelve el nodo padre del DOM Element, o null, si el nodo no tiene padre o si el padre no es un Element DOM .

Sintaxis

elementoPadre = node.parentElement

El elementoPadre es el padre del nodo actual. Esto es siempre un objecto Element DOM, o null.

Ejemplo

js
if (node.parentElement) {
 node.parentElement.style.color = "red";
}

Especificaciones

Specification
DOM
# ref-for-dom-node-parentelement1

Compatibilidad con navegadores

Ver también

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /