Apologies for the awkward question. I am currently working on a solution to create a table using div tags, which is functioning properly. However, I am facing an issue with adding or removing a row using jQuery. The problem lies in the fact that when a new row is added, it only populates the columns under "Header1". Despite my efforts to troubleshoot and resolve this issue, I have not been successful. I am reaching out here as my final attempt for assistance.
I have attempted to create a functional snippet, but unfortunately the "add new row" feature is not working here, although it does work in my browser..
$('#addrow').click(function(){
var length = $('.sl').length;
var i = parseInt(length)+parseInt(1);
var newrow = $('#next').append('<div class="divTableRow"><div class="divTableCell"><input type="text" class="form-control sl" name="slno[]" value="'+i+'" readonly=""></div><div class="divTableCell"><input type="text" class="form-control" name="name[]" id="acc_name'+i+'" placeholder="Enter Account Name" pattern="[^()/><\][\\\x22,;|]+"></div><div class="divTableCell"><select name="rang[]" id="rang_acc'+i+'" style="width:170px !important;font-weight: normal !important;" class="form-control"><option value="Bacteria">Bacteria</option><option value="Low Life">Low Life</option><option value="Apprentice">Apprentice</option><option value="Hitman">Hitman</option><option value="Assassin">Assassin</option><option value="Local Boss">Local Boss</option><option value="Boss">Boss</option><option value="Godfather">Godfather</option></select></div><div class="divTableCell"><input type="text" class="form-control" name="phone_no[]" id="pn'+i+'" placeholder="Enter Phone No"></div><div class="divTableCell"><input type="text" class="form-control" id="age'+i+'" name="...
});
// Removing event here
$('body').on('click','.btnRemove',function() {
$(this).closest('div').remove()
});
div.blueTable {
border: 1px solid #1C6EA4;
background-color: #EEEEEE;
width: 100%;
text-align: left;
border-collapse: collapse;
}
.divTable.blueTable .divTableCell, .divTable.blueTable .divTableHead {
border: 1px solid #AAAAAA;
padding: 3px 2px;
}
.divTable.blueTable .divTableBody .divTableCell {
font-size: 13px;
}
.divTable.blueTable .divTableRow:nth-child(even) {
background: #D0E4F5;
}
.divTable.blueTable .divTableHeading {
background: #1C6EA4;
background: -moz-linear-gradient(top, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
background: -webkit-linear-gradient(top, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
background: linear-gradient(to bottom, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
border-bottom: 2px solid #444444;
}
.divTable.blueTable .divTableHeading .divTableHead {
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
border-left: 2px solid #D0E4F5;
}
.divTable.blueTable .divTableHeading .divTableHead:first-child {
border-left: none;
}
.blueTable .tableFootStyle {
font-size: 11px;
}
.blueTable .tableFootStyle .links {
text-align: right;
}
.blueTable .tableFootStyle .links a{
display: inline-block;
background: #1C6EA4;
color: #FFFFFF;
padding: 2px 8px;
border-radius: 5px;
}
.blueTable.outerTableFooter {
border-top: none;
}
.blueTable.outerTableFooter .tableFootStyle {
padding: 3px 5px;
}
/* DivTable.com */
.divTable{ display: table; }
.divTableRow { display: table-row; }
.divTableHeading { display: table-header-group;}
.divTableCell, .divTableHead { display: table-cell;}
.divTableHeading { display: table-header-group;}
.divTableFoot { display: table-footer-group;}
.divTableBody { display: table-row-group;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<form class="form-horizontal" action="#" method="post">
<div class="divTable blueTable">
<div class="divTableHeading">
<div class="divTableRow">
<div class="divTableHead">head1</div>
<div class="divTableHead">head2</div>
<div class="divTableHead">head3</div>
<div class="divTableHead">head4</div>
<div class="divTableHead">head5</div>
<div class="divTableHead">head6</div>
</div>
</div>
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell"&g...
<div id="next"></div>
</div>
</div>
<br/>
<button type="button" name="addrow" id="addrow" class="btn btn-success pull-right">Add New Row</button>
<br/><br/>
<button type="submit" name="submit" class="btn btn-info pull-left">Submit</button>
</form>