Children jquery selector

0
<td class="day base-a" data-month="11" data-year="2018" data-day="05" data-maxday="4">
    <label>5</label>
    <div class="price-tot">
        <div class="tb-col">
            <span class="price-cal" ></span>
        </div>
        <div class="tb-col tb-top">
            <span class="cal-moneda"></span>
        </div>
    </div>
    <span class="precio base-a">15,393</span>
    <span class="llegada">Llegada</span>
    <span class="final">Salida</span>
</td>

With jquery I want to put text to the cal-currency and price-cal span

I tried the following

$elemento.children("div.price-tot").children("span.price-cal").text(price);
$elemento.children("div.price-tot").children("span.cal-moneda").text(settings.moneda);

but it does not set it

    
asked by Ernesto Emmanuel Yah Lopez 30.10.2018 в 19:04
source

1 answer

0

The problem is that .children() only searches among the direct children of the selector. Try it with .find() like this:

$elemento.find("span.price-cal").text(price); 
$elemento.find("span.cal-moneda").text(settings.moneda);
    
answered by 30.10.2018 в 19:11