Mam skrypt jQuery, który wygląda przez liście div, a potem to dzieci, a drukuje się:
- Tytuł itemu
- opis elementu
problem mam zwrócić uwagę jest to, że choć oba console.log()
s są obok siebie w wewnętrznej $.each()
, ja się spodziewać:
Tytuł 1 Opis 1 Tytuł 2 Tytuł Opis 2 3 Opis 3 ... itd
Zamiast co widzę to:
Tytuł 1 Tytuł 2 Tytuł 3 .. etc
Opis 1 Opis 2 Opis 3 ... itd
zmieniane wewnętrzne .find()
s:
SCRIPT.INI
$('.ghx-backlog').each(function(){
$($(this).find('div[class*=has-issues]')).each(function(index){
console.log($(this).find('.ghx-key > a').text()); //The Title
console.log($(this).find('.ghx-summary > span').text()); //The Description
});
});
znaczników:
<div id="ghx-backlog" class="ghx-backlog" data-rendered="123456789">
<div class="ghx-issues js-issue-list ghx-has-issues">
<div class="js-issue js-sortable js-parent-drag ghx-issue-compact ghx-type-6" data-issue-id="1233456" data-issue-key="Title 1">
<div class="ghx-issue-content">
<div class="ghx-row">
<div class="ghx-key">
<a href="/browse/Title 1" title="Title 1" class="js-key-link">XXXXXX-##</a>
</div>
<div class="ghx-summary" title="Description 1">
<span class="ghx-inner">Description 1</span>
</div>
</div>
<div class="ghx-row">
<div class="ghx-key">
<a href="/browse/Title 2" title="Title 2" class="js-key-link">XXXXXX-##</a>
</div>
<div class="ghx-summary" title="Description 2">
<span class="ghx-inner">Description 2</span>
</div>
</div>
</div>
</div>
</div>
</div>
proszę pokazać nam kod HTML. –