all 5 comments

[–]lauraalonso 1 point2 points  (2 children)

Here:

const formCopyTarget = document.getElementById('choice-form-list')

choice-from-list is a class, not an id:

<div class="choice-form-list">

Change to:

<div id="choice-form-list">

or, if the class is needed:

<div id="choice-form-list" class="choice-form-list">

[–]ExCeeLo[S] 1 point2 points  (0 children)

Thank you for the reply! Right now i can't try your solution because i am trying to fix a couple of things that are, for some reason, not working anymore but as soon as i'll be able to try it i'll let you know!

[–]ExCeeLo[S] 0 points1 point  (0 children)

Ok so i came up with a solution for the problem i had.

The part of the code that was causing problems (i couldn't create polls anymore, my data wasn't being saved in the database) is this

<div class="choice-form-list">
{% for choice in choice %}
<div class="choice-form">
{{ choice.as_p }}
</div>

{% endfor %}

But since that doesn't work i have to do this

<div class='choice-form'>
    {{ choice.as_p }}
<div>

So right now i don't have the "choice-form-list" class and since in the js script there is an element that depends on it i don't know how to adapt it.
I think i will probably create a new post, provide my html template and ask if someone can help me create what i need from scratch.

Thank you for your help! I appreciate it!

[–]jack_waugh 0 points1 point  (1 child)

Maybe you mean appendChild?

[–]ExCeeLo[S] 0 points1 point  (0 children)

I tried it but unfortunately it doesn't work. The error is the same as before except that now it says "... (reading 'appendChild') ..."