1
I have the following code:
<div></div>
<div>
<div class='minhaClasse'>
<div id='text'>hhaushdus</div>
<input name='profile_id' />
<div>
</div>
I need to take this div:
<div class='minhaClasse'>
<div id='text'>hhaushdus</div>
<input name='profile_id' />
<div>
I tried this way:
let element = document.getElementsByName('profile_id')[0].parentNode;
that returned me the father:
<div>
<div class='minhaClasse'>
<div id='text'>hhaushdus</div>
<input name='profile_id' />
<div>
</div>
Basically it’s two questions, how do I get this div with class 'madcap' and you can make a getElement of a getElement guy:
document.getElementsByName('profile_id')[0].parentNode.getElementByClassName('minhaClasse'));
But the goal is to catch a parent element with the class
minhaClasseor a brother ? In the given exampleminhaClasseis the father ofprofile_id– Isac