0

I'm working with a js program that I don't know how to edit. It's outputting redundant code for my need So I'm wondering if there is a way to hide the 1st label and 1st span of it's output within a specific div. Here is the output

<div class="rnTotalBox">
    <label></label>  //hide this 
    <span class="price rn-price "> //hide this
        <span class="amount">$0.00</span> //hide this
    </span> //hide this
    <label>Final Total</label><span class="price rn-price ">
        <span class="amount">$0.00</span>
    </span>
</div>

I thought I could use css like this:

.rnTotalBox label:first-child {
    display:none;
}
.rnTotalBox span:first-child {
    display:none;
}

but they hide everything no matter what. Is there a way to hide the first label and the first span?

Martin
  • 22,212
  • 11
  • 70
  • 132
rudtek
  • 373
  • 2
  • 17

1 Answers1

1

you can use the label:first-of-type selector!

https://css-tricks.com/almanac/selectors/f/first-of-type/

Ale Plo
  • 799
  • 4
  • 11