//
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

Advertisements

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: