Script is not working in html for my django project

first of all. It's my first time asking a question here. So if I do sth wrong I'm sorry for that.

As I am pretty new to programming I really don't get where the problem is with my html right now. Basically I want the Script to do aa new Textbox so that I can do more and more Questions. Kinda like in the image below.

enter image description here

The Code for my html right now looks like that.


{% extends "index.html" %}

{% block content %}
    <div>
        <h1 class="text-center">Multiple-Choice-Aufgaben</h1>
    </div>
    <br>
    <div>
    <input type="text" name="form-name" placeholder="Form Name" class="form-control">
</div>
<br>
<div style="border: 1px solid black">
    <input type="text" name="I" placeholder="Frage hier hinschreiben" class="form-control">
    <br>
    <i>Short answered text</i>
</div>
<br>
<button type="button" class="btn btn-lg btn-outline-primary" onclick="createNewQuestion();">Neue Frage hinzufügen</button>
<button type="button" class="btn btn-lg btn-outline-success">Aufgabenblatt erstellen</button>

<script>
    let questionCount = 0;
    function createNewQuestion() {
        let DIV = document.createElement("div");
        let BR = document.createElement("BR")
        DIV.setAttribute("style", "border: 1px solid black")
        DIV.innerHTML = <input type="text" name="${questionCount}" placeholder="Frage hier einfügen:" class="form-control"><i>Kurze Antwort</i>
        document.getElementById("questions").appendChild(DIV);
        document.getElementById("questions").appendChild(BR);
        questionCount++;
    }

</script>

{% endblock %}`


I would be really grateful if somebody could help me because I really don't know why the script isn't working at all.

Back to Top