Get all value inside div element using ID

30 Views Asked by At

I think this is just a simple problem but I am stocked. I can't get all the value inside my div.

HTML Code

<div class="notice-items" id="notice-items">
   <div class="js-filter-item"
      data-filter-tags="${article.getTagValue}" >
         ${article.getTagValue}
   </div>
   <div class="js-filter-item"
      data-filter-tags="${article.getTagValue}" >
         ${article.getTagValue}
   </div>
   <div class="js-filter-item"
      data-filter-tags="${article.getTagValue}" >
         ${article.getTagValue}
   </div>
   <div class="js-filter-item"
      data-filter-tags="${article.getTagValue}" >
         ${article.getTagValue}
   </div>
</div>

Javascript Code

var $filterContainer = $("#".concat($('.js-tag-filters').data('container-id')));
var $filterItems = $filterContainer.find('.js-filter-item');
        
console.log("-- $filterContainer : " + JSON.stringify($filterContainer));
console.log("-- $filterItems : " + JSON.stringify($filterItems));

Out of all 4 values, only the first one is showing on my console. enter image description here

Thanks in advance for those who will help!

I've tried other javascript syntax but I can't still get the right output. Hope you could help.

0

There are 0 best solutions below