2
I have a sequence of Ivs like the ones below.
<div class="upage" id="id01">
<div class="main" id="id02">
<div class="main2" id="id03">
</div>
</div>
</div>
I need to get the id of the class that is above in this case should returns id01
.
I use the parents(".upage");
but he comes to me a pointer with the whole div. I need to get only the ID.
How to do ?
What is the starting point element? Perhaps the
closest()
be the best?.closest('.upage').attr('id');
– Sergio
The starting point is an input with Focus.
– Renan Rodrigues