function updateInsertRecords(){arrys = arry.join(",");$('#insertRecords').val(arrys);}
var cnt = 1;
var container = $(document.createElement('span'));
var newitems = $(document.createElement('span'));
$('.span.fixed').before(container);
var arry = [], arrys = "";
$('#btAdd').click(function() {
var groupname = $(this).attr('data-id');
var isselect = $(this).attr('data-coral');
if (cnt <= 9999) {
cnt = cnt + 1;
arry.push(cnt);
$(container).append('<span class="twodelete" data-cnt="' + cnt + '"><div class="margin5px modal-partition"><label for="Name">Name</label><input data-placement=bottom type=text name="field' + '' + cnt + '" id="field' + '' + cnt + '" class=form-control data-rule-required=true data-msg-required="Provide field details" /></div><div class="margin5px modal-partition"><label for="status' + '' + cnt + '">Status</label><select name="status' + '' + cnt + '" id="status' + '' + cnt + '" class="form-control" data-rule-required="true" data-msg-required="Provide Status details"><option value="1">Active</option><option value="0">Inactive</option></select></div><input type="button" id="btRemove" rel="' + groupname + '_' + cnt + '" value="X" class="sectionBtn bt" /></span>');
}
arrys = arry.join(",");
$('.buttonsPlaceHolder').before(container);
$('.buttonsPlaceHolder').after(newitems);
updateInsertRecords();
});
$(document).on('click', '#btRemove', function(){
var item = $(this).closest('.twodelete');
var v = item.data('cnt');
for(var i = arry.length - 1; i >= 0; i--) {
if(arry[i] === v) {
arry.splice(i, 1);
break;
}
}
updateInsertRecords();
item.remove();
});
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE