10 examples of 'jquery add row to table after specific row' in JavaScript

Every line of 'jquery add row to table after specific row' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
982_appendRow($table, rowDifference) {
983 const newRow = $table.find('tr').last().clone();
984 const brHTMLSting = isIE10 ? '' : '<br />';
985
986 newRow.find('td').html(brHTMLSting);
987
988 for (; rowDifference < 0; rowDifference += 1) {
989 $table.find('tbody').append(newRow.clone()[0]);
990 }
991}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

260function table_tr_prepend(index){
261 $("tr.slave[data-index=" + index + "]").each(function(){
262 $("#nodes-details").prepend( $(this).prop("outerHTML") );
263 $(this).remove();
264 });
265 var master_content = $("tr.master[data-index=" + index + "]").prop("outerHTML");
266 $("tr.master[data-index=" + index + "]").remove();
267 $("#nodes-details").prepend( master_content );
268};
120function afterAddRow(new_row, fileindex)
121{
122
123 jQuery('*', new_row).each(function()
124 {
125 jQuery.each(this.attributes, function(index, element){
126 this.value = this.value.replace(/{{row-count-placeholder}}/, fileindex);
127 this.value = this.value.replace(/_row_count_placeholder_id_/, fileindex);
128 });
129 });
130
131}
19function appendRow(row) {
20 var that = this;
21
22 function exists(item) {
23 return that.identifier && item[that.identifier] === row[that.identifier];
24 }
25
26 if (!this.rows.contains(exists)) {
27 this.rows.push(row);
28 return true;
29 }
30
31 return false;
32}
186addRow(row) {
187 this.rows.push(row)
188}
10function get_row($row){
11 var counter = $row.attr('data-counter');
12 var row = rows[counter];
13 if (row){
14 return row;
15 }
16 var $modal = $row.parent().parent().parent();
17 row = {
18 counter: counter,
19 $row: $row,
20 $modal: $modal,
21 $submit: $modal.find('button[type="submit"]'),
22 show_msg: function (msg, color){
23 var $msg = $('<span/>').html(msg);
24 if (color){
25 $msg.css('color', color);
26 }
27 this.$row.find('.message').html('').append($msg);
28 },
29 block: function(){
30 this.$row.find('input,select').not('.email').attr('disabled', 1);
31 this.$row.addClass('blocked');
32 this.$submit.attr('disabled', '1');
33 },
34 disable_known_field: function(field){
35 this.$row.find('[name=' + this.counter + '-' + field + ']').attr('disabled', 1);
36 },
37 reset: function(){
38 // remove message and restrictions
39 this.$row.find('input,select').removeAttr('disabled');
40 this.$row.find('.message').html('');
41 this.$row.removeClass('blocked');
42 if (!this.$modal.find('.row.blocked').length){
43 this.$submit.removeAttr('disabled');
44 }
45 }
46 };
47 rows[counter] = row;
48 return row;
49}
933_addTbodyOrTheadIfNeed($table) {
934 const isTheadNotExists = !$table.find('thead').length;
935 const isTbodyNotExists = !$table.find('tbody').length;
936 let absentNode;
937
938 if (isTheadNotExists) {
939 absentNode = $('<thead><tr></tr></thead>').get(0);
940 $table.prepend(absentNode);
941 } else if (isTbodyNotExists) {
942 absentNode = $('<tbody><tr></tr></tbody>').get(0);
943 $table.append(absentNode);
944 }
945}
93function rowUp() {
94 var item = $('.active').parent();
95 item.after(item.prev('.ui-row'));
96}
22function editRow(oTable, nRow) {
23 var aData = oTable.fnGetData(nRow);
24 var jqTds = $('>td', nRow);
25 var record_types = "";
26 for(var i = 0; i < records_allow_edit.length; i++) {
27 var record_type = records_allow_edit[i];
28 record_types += "<option value=\"" + record_type + "\">" + record_type + "</option>";
29 }
30 jqTds[0].innerHTML = '<input type="text" class="form-control input-small" value="' + aData[0] + '">';
31 //jqTds[1].innerHTML = '<select class="form-control" id="record_type" name="record_type" value="' + aData[1] + '"' + '><option value="A">A</option><option value="AAAA">AAAA</option><option value="NS">NS</option><option value="CNAME">CNAME</option><option value="DNAME">DNAME</option><option value="MR">MR</option><option value="PTR">PTR</option><option value="HINFO">HINFO</option><option value="MX">MX</option><option value="TXT">TXT</option><option value="RP">RP</option><option value="AFSDB">AFSDB</option><option value="SIG">SIG</option><option value="KEY">KEY</option><option value="LOC">LOC</option><option value="SRV">SRV</option><option value="CERT">CERT</option><option value="NAPTR">NAPTR</option><option value="DS">DS</option><option value="SSHFP">SSHFP</option><option value="RRSIG">RRSIG</option><option value="NSEC">NSEC</option><option value="DNSKEY">DNSKEY</option><option value="NSEC3">DSEC3</option><option value="NSEC3PARAM">NSEC3PARAM</option><option value="TLSA">TLSA</option><option value="SPF">SPF</option><option value="DL">DL</option><option value="SOA">SOA</option></select>';
32 jqTds[1].innerHTML = '<select class="form-control" id="record_type" name="record_type" value="' + aData[1] + '"' + '>' + record_types + '</select>';
33 jqTds[2].innerHTML = '<select class="form-control" id="record_status" name="record_status" value="' + aData[2] + '"' + '><option value="false">Active</option><option value="true">Disabled</option></select>';
34 jqTds[3].innerHTML = '<select class="form-control" id="record_ttl" name="record_ttl" value="' + aData[3] + '"' + '><option value="60">1 minute</option><option value="300">5 minutes</option><option value="1800">30 minutes</option><option value="3600">60 minutes</option><option value="86400">24 hours</option></select>';
35 jqTds[4].innerHTML = '<input type="text" class="form-control input-small advance-data" value="' + aData[4] + '">';
36 jqTds[5].innerHTML = '<a class="btn default btn-xs green edit" href="">Save</i></a>';
37 jqTds[6].innerHTML = '<a class="btn default btn-xs green cancel" href="">Cancel</i></a>';
38
39 // set current value of dropdows column
40 if (aData[2] == 'Active'){
41 isDiable = 'false';
42 }
43 else {
44 isDiable = 'true';
45 }
46
47 SelectElement('record_type', aData[1]);
48 SelectElement('record_status', isDiable);
49 SelectElement('record_ttl', aData[3]);
50 }
173function editRow(oTable, nRow) {
174 var aData = oTable.fnGetData(nRow);
175 var jqTds = $('>td', nRow);
176 jqTds[0].innerHTML = '<input type="text" class="form-control input-small" value="' + aData[0] + '">';
177 jqTds[1].innerHTML = '<input type="text" class="form-control input-small" value="' + aData[1] + '">';
178 jqTds[2].innerHTML = '<input type="text" class="form-control input-small" value="' + aData[2] + '">';
179 jqTds[3].innerHTML = '<input type="text" class="form-control input-small" value="' + aData[3] + '">';
180 jqTds[4].innerHTML = '<a href="#" class="btn btn-success btn-xs save"><i class="fa fa-save"></i> Save</a> <a href="#" class="btn btn-warning btn-xs cancel"><i class="fa fa-times"></i> Cancel</a>';
181}

Related snippets