I am working with javascript/jquery and right now I have button "Add task",whenever i click on that button then "multiple form" creating with "add subtask" button but i want to add one more thing:
Whenever i click on any "Add subtask", then another form should appear in front of "Main form (parent form)"
Here is my current code:
var count = 0;
$('.buttonClass').click(function() {
count += 1;
$("<form name='myform''/>").appendTo('body');
$("<input placeholder='this is a main task'/>").appendTo('body');
$("<input type='submit' name='' value='Add subtask'/>").appendTo('body');
$("<br>").appendTo('body');
$("</form/>").appendTo('body');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<button class="buttonClass">Add Task</button>