<b></b>
, и адрес, заключенный в тэг <i></i>
.<b>
и <i>
.<div class="form" id="invoice_form">Send <b>1000 rub</b> to <i>4279380040001111</i></div>
function getFormData(selector) {
const form = document.querySelector(selector)
const price = form.querySelector('b')
const location = form.querySelector('i a')
const [sum, currency] = price.innerText.split(' ')
const address = location.innerText
return {
address,
amount: {
sum: +sum,
currency,
}
};
}
const data = getFormData('#invoice_form')
console.log(data);
{
"address": 4279380040001111,
"amount": {
"sum": 1000,
"currency": "rub"
}
}