parent
del cual inherits
propiedades.
Por ejemplo, su elemento jQuery Playground
h3
tiene el elemento primario de <div class="container-fluid">
, que a su vez tiene el body
principal.
jQuery tiene una función llamada parent()
que le permite acceder al padre de cualquier elemento que haya seleccionado.
Este es un ejemplo de cómo usaría la función parent()
si quisiera darle al elemento padre del elemento del left-well
un color de fondo azul:
$("#left-well").parent().css("background-color", "blue")
#target1
al padre del elemento #target1
un color de fondo rojo.
left-well
debe tener un fondo rojo.
testString: 'assert($("#left-well").css("background-color") === "red" || $("#left-well").css("background-color") === "rgb(255, 0, 0)" || $("#left-well").css("background-color").toLowerCase() === "#ff0000" || $("#left-well").css("background-color").toLowerCase() === "#f00", "Your left-well
element should have a red background.");'
- text: 'Deberías usar la función .parent()
para modificar este elemento.'
testString: 'assert(code.match(/\.parent\s*\(\s*\)\s*\.css/g), "You should use the .parent()
function to modify this element.");'
- text: 'El método .parent()
debe llamarse en el elemento #target1
.'
testString: 'assert(code.match(/\$\s*?\(\s*?(?:"|")\s*?#target1\s*?(?:"|")\s*?\)\s*?\.parent/gi), "The .parent()
method should be called on the #target1
element.");'
- text: Solo use jQuery para agregar estas clases al elemento.
testString: 'assert(code.match(/