add "Add new" button for traits
This commit is contained in:
parent
969ef67c08
commit
f73f0801d7
@ -1,14 +1,26 @@
|
|||||||
<a href="/admin"> go Back </a> <br>
|
<a href="/admin"> go Back </a> <br>
|
||||||
|
|
||||||
<section>
|
<section id="traits">
|
||||||
{%for trait in traits%}
|
{%for trait in traits%}
|
||||||
<section id="{{trait['id']}}">
|
<section id="{{trait['id']}}">
|
||||||
<p> Name: </p>
|
<p> Name: </p>
|
||||||
<input value="{{trait['name']}}">
|
<input class="name_input" value="{{trait['name']}}">
|
||||||
<p> Description: </p>
|
<p> Description: </p>
|
||||||
<input value="{{trait['desc']}}">
|
<input class="desc_input" value="{{trait['desc']}}">
|
||||||
</section>
|
</section>
|
||||||
{%endfor%}
|
{%endfor%}
|
||||||
</section>
|
</section>
|
||||||
|
<button onclick="addNewInput()">Add new</button>
|
||||||
|
|
||||||
<p>Images are viewable in the npc views</p>
|
<p>Images are viewable in the npc views</p>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function addNewInput(){
|
||||||
|
let newTrait = traits.lastElementChild.cloneNode(true);
|
||||||
|
newTrait.querySelector(".name_input").value = "";
|
||||||
|
newTrait.querySelector(".desc_input").value = "";
|
||||||
|
traits.appendChild(newTrait);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user