假設我有一個這樣的結構在我的div如何檢查嵌套標籤的內容存在與否
<div class="mainDiv">
<div class="addrLabel">Address</div>
<div class="addrValue">
<!-- this content value i want to check if exist, then grab it else no value -->
the content which i want to check if exist or not. if a single value is there i want to grab it also
<span class="hrefClass">
<a href="#">next link</a>
</span>
</div>
<div class="clearfix"></div>
我第二次是在重複這個div與空值
<div class="mainDiv">
<div class="addrLabel">Address</div>
<div class="addrValue">
<!-- no value at all -->
<span class="hrefClass">
<a href="#">next link</a>
</span>
</div>
<div class="clearfix"></div>
我怎樣才能做到這一點
下面的答案沒有解決我的問題,因爲我想檢查是否有一個內容然後只有我想推 – EaB
請提供我的解決方案,如果沒有任何價值,但3回答沒有解決這個 – EaB
這裏是一個小提琴不輸入其他條件推送沒有值存在https://jsfiddle.net/ur5fntvp/8/ – EaB