F
F
Friend2017-01-15 14:35:44
JavaScript
Friend, 2017-01-15 14:35:44

How to change text form value in html?

There is a html side on it textbox from a form with django, tried changing the value with

document.getElementById('id_records_text').innerText = document.getElementById('id_records_text').textContent + 4

<form action="drecords" method="post">
                        {% csrf_token %}
                        {{ form }}
                        <input class="button" type="submit" value="отправить">
                    </form>

Everything changes everything is fine and it can be seen on the page, but as soon as I wrote something manually in the field and try to add it again, the value is not added visually on the site, but it still changes in the xml.
How can it be changed?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Sklyarov, 2017-01-15
@0example

Because you are inserting just text, but you need to insert a value, the easiest way to do this is to use .val () with the jQuery library included.
api.jquery.com/val

T
Tyrion Lannister, 2017-01-16
@baYonet_cpp

innerText is the text inside, and the value of the intput is element.value

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question