0
I’m trying to implement a button to add extra fields, in case I’m creating an activity report where it contains 5 fields. When the button is clicked it adds 5 more of these same field.
Currently I have:
Javascript
$(function () {
var scntDiv = $('#dynamicDiv');
$(document).on('click', '#addInput', function () {
$('<p>'+
'<input type="text" id="inputeste" size="20" value="" placeholder="" /> '+
'<a class="btn btn-danger" href="javascript:void(0)" id="remInput">'+
'<span class="glyphicon glyphicon-minus" aria-hidden="true"></span> '+
'</a>'+
'</p>').appendTo(scntDiv);
return false;
});
$(document).on('click', '#remInput', function () {
$(this).parents('p').remove();
return false;
});
});
HTML
<div id="dynamicDiv"></div>
How I return several days, and each day may exist N tasks, when I click add fields, only the first day is added, and in each day I have a button.
EDIT 1:
In my case, I have the days generated dynamically, and each day I have a button to add, when to on day 21 for example and I click add, it is added normally because it is my first field, if to on day 22 and click to add it adds the fields in day 21 panel.
How do I know which day to add?
Image does not help at all, posting the code is what can help!
– user60252