N
N
Nik Master2021-06-22 19:26:07
JavaScript
Nik Master, 2021-06-22 19:26:07

How to add data from input field in onclick?

There is a code that adds a button to the site with a form for a loan from Tinkoff.

<!doctype html>
<html>
  <head>
    <meta charset="UTF-8">
    <script src="https://forma.tinkoff.ru/static/onlineScript.js"></script>
  </head>
  <body>
    <button
      type="button"
      class="TINKOFF_BTN_YELLOW"
      onclick="tinkoff.createDemo({
        shopId: 'SHOP_ID',
        showcaseId: 'SHOWCASE_ID',
        demoFlow: 'sms',
        items: [
          {name: 'iPhone 11', price: 100000, quantity: 1},
          {name: 'Чехол', price: 500, quantity: 1}
        ],
        promoCode: 'default',
        sum: 100500
      })"
      ></button>
  </body>
</html>


The form will look like this:
60d20e9c3dd58568085713.png

How can I transfer the number that the person himself enters instead of the goods? That is, instead of sum and price, the value from the input field is substituted. Yes, and the input field itself needs to be pushed into this form somehow.))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aricus, 2021-06-23
@Aricus

document.querySelector('[name="sum"]').value

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question