//
you're reading...
Javascript

Set width for td in table

Easy solution is create a div inside of td and set width for it by jquery

$(document).ready(function() {
    $("td").each(function(index) {
       var htmlText = "
<div style='width:300px;'>" + $(this).text() +"</div>
";
       $(this).html(htmlText);
  });
});

Ref: https://stackoverflow.com/a/21855603/3551956

Discussion

No comments yet.

Leave a comment