I have a table with 3 columns. I would like to convert to single row.
both append.('</tr><tr>') and after.('</tr><tr>') do not work.
Want it like this for mobile friendly page -
Thank you for your help!
http://jsfiddle.net/tZt3Q/
One way you can achieve this is by using JQuery wrap method. See Wrap and UnWrap
Demo
Demo W/O class
$(document).ready(function () {
var tbl = $("table");
$('td','table').unwrap().each(
function () {
tbl.append($(this).wrap('<tr>').parent());
});
});
Much simpler one:
$(document).ready(function () {
$('table').find('td').unwrap().wrap($('<tr/>'));
});
Fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With