• 31-12-2022, 13:17:51
    #1
    Merhaba
    bu jquery nodelarla ilgili bir problem var kodlarda elementleri yanlış mantıkta çekiyorum sanırım.
    Yardımcı olabilir misiniz?

    <ul class="list">
        <li class="dev-ingredient">
            <a href="xxx"></a>
            <a href="xxx"></a>
            <strong class="dev-ingredient-amount"></strong>
            <strong class="dev-ingredient-value"></strong>
            <span class="dev-ingredient-key"></span>
        </li>
    </ul>
    <script>
    $(`li.dev-ingredient.childNodes `, html).each(function(){
        const amount= (this).find('dev-ingredient-amount').text();
        const ingredientValue=$(this).find('.dev-ingredient-value').text();
        const ingredientKey=$(this).find('.dev-ingredient-key').text();
        
      
        displayRecipe.push({
            amount,
            ingredientKey,
            ingredientValue
        })
    })
    </script>
  • 31-12-2022, 14:05:48
    #2
    Problem çözülmüştür. 11. satır şu şekilde düzeltilmiştir

    $(`ul.list > li `, html).each(function(){