This one-line jQuery will do what you need. Just apply it to each row you need to reformat:
$('#tr01').append($('#tr02').contents());
There's a fiddle here
Try like this:
$( "#tr03 > td" ).appendTo( "#tr01" );
You can refer : http://api.jquery.com/appendTo/
My one cent - use clone to copy the td's and then move the tds around so that you preserve the events attached to them, if any.
Try
var $rows = $('#myTableID tr');
$rows.slice(0, Math.ceil($rows.length / 2)).each(function () {
var $this = $(this),
index = $this.index();
$this.append($rows.eq(index * 2).find('td'))
$this.append($rows.eq(index * 2 + 1).find('td'))
})
Demo: Fiddle
this is other option you can create/replace table by click of button
max = 2
$("button").click(function() {
var tr = $("table tr:last");
if(!tr.length || tr.find("td").length >= max)
$("table").append("<tr>");
$("table tr:last").append("<td>hi</td>");
});
<table border=1></table>
<button>hi</button>
Hi I have an array like this. var i; for(i=0;i<10;i++){ $('<input/>').attr('type','text') .attr('name','TxtBx_[]') .attr('id','TxtBx_' + i) ...
Hi I have an array like this. var i; for(i=0;i<10;i++){ $('<input/>').attr('type','text') .attr('name','TxtBx_[]') .attr('id','TxtBx_' + i) ...
Why doesn't the name function work. The chrome console outputs 'string is not a function'? Please provide the answer. Thanks <html> <head> <script type="text/javascript"> ...
Why doesn't the name function work. The chrome console outputs 'string is not a function'? Please provide the answer. Thanks <html> <head> <script type="text/javascript"> ...
I declared my variable first - then have my jquery : var cimg = ''; jQuery(function($) { $(".trigger").click(function() { var cimg = event.target.id; clickedimage(); loadPopup(); }); }); ...
I declared my variable first - then have my jquery : var cimg = ''; jQuery(function($) { $(".trigger").click(function() { var cimg = event.target.id; clickedimage(); loadPopup(); }); }); ...
I have little problem with my webpage. When I'm trying to show InfoWindow on marker. That windows shows on the top left corner of a map instead of on the marker. Just like in screen below: Here is my ...
I have little problem with my webpage. When I'm trying to show InfoWindow on marker. That windows shows on the top left corner of a map instead of on the marker. Just like in screen below: Here is my ...