как скопировать содержимое значения html class="price" в javascript "Price":"97000"?

<span class="price">107000</span>

<script>
    CLObject.create({
        "orderId": "5d540ecce81675abfb4e022676cc1fd2-69951d6afb0bf4d47055aec97266c53134",
        "goods":[{
            "Name": "Apple iPhone X 64 GB",
            "Price": "97000",
            "Count": 1
        }],
        "site":"site",
        "shopName":"site",
        "URLSuccess":"",
        "autostart":true,
        "elm":"lkredit",
        "onPage":true
    });
</script>

Ответы (1 шт):

Автор решения: Александр Лесив

const obj = {
  "orderId": "5d540ecce81675abfb4e022676cc1fd2-69951d6afb0bf4d47055aec97266c53134",
  "goods": [{
    "Name": "Apple iPhone X 64 GB",
    "Price": "97000",
    "Count": 1
  }],
  "site": "site",
  "shopName": "site",
  "URLSuccess": "",
  "autostart": true,
  "elm": "lkredit",
  "onPage": true
}

obj.goods[0].Price = document.querySelector('.price').textContent;
console.log(obj);
<span class="price">107000</span>

→ Ссылка