1
I need to basically check if a certain div exists within a list, the structure is like this:
<div class="content" id="divCheck">
<div class="filho" value="1"></div>
<div class="filho" value="2"></div>
<div class="filho" value="3"></div>
</div>
<div class="content">
<div class="filho" value="1"></div>
<div class="filho" value="2"></div>
<div class="filho" value="3"></div>
</div>
How can I check if in the div with id divCheck
there is an element with some value, it would be correct to make a each
in this div or to do this with a simple if
even?
That code of yours is strange,
<div>
without closing them, and with values... That’s the code?– LocalHost
I forgot to close, but the code is just an example to simplify the understanding of the question. But yes the values are necessary, maybe I will change to the attribute "date-" in the future.
– Leo Letto
Oh yes, but what exactly do you want? check if there is a certain element? Or take all the elements within it that have some value?
– LocalHost
Just check if within a certain div there is any element with that Value, such attribute in this case will be unique of that element within the div, and need to manipulate differently if it already exists, if I should not add a
– Leo Letto
Why don’t you use
class
/id
in place ofvalue
, since they are not text(input) fields and this property will not be displayed to the user. This is usually done when you want to reference an element or even check if it exists.– mau humor