Answer the question
In order to leave comments, you need to log in
How to save changes to contenteditable="true"?
I'm using flask, how do I change the text on the site and click on the button to save it? I tried with name = request.form['name'], but didn't get(
<div class="cards">
{% for item in items %}
<div class="card card-item-01">
<div class="card__image-wrapper">
<img class="card__image" src="/static{{item[2]}}" alt="Desert" width="280" height="420">
</div>
<form method="POST">
<div class="card__content">
<h5 contenteditable="true" class="card__category" name = "name" >{{item[3]}}</h5>
<h2 contenteditable="true" class="card__title" >{{item[0]}}</h2>
<p contenteditable="true" class="card__text">{{item[1]}} года</p>
<p contenteditable="true" class="card__desc">{{item[7]}}</p>
<p contenteditable="true" class="card__city">{{item[8]}}</p>
<button>Сохранить</button>
</div>
</form>
</div>
{% endfor %}
Answer the question
In order to leave comments, you need to log in
contenteditable is not an input in the concept of the form, so only through js, for example, you make the field hidden, and onsubmit you take the content of the contenteditable, throw the fields in the hidden value and submit the form. Or immediately transfer the contenteditable when changing.
how do you change the text? You have a form, it would be logical to use form elements inside
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question